Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.py +1579 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.pyi +124 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_afm.py +532 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_animation_data.py +262 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_blocking_input.py +30 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_c_internal_utils.pyi +8 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm.py +1460 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_bivar.py +1312 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_listed.py +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_multivar.py +166 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_color_data.py +1141 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_color_data.pyi +6 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_constrained_layout.py +805 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_docstring.py +141 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_docstring.pyi +34 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_enums.py +177 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_enums.pyi +19 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py +111 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_image.pyi +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_internal_utils.py +64 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_layoutgrid.py +547 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_mathtext.py +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_mathtext_data.py +1742 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_path.pyi +9 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_pylab_helpers.py +134 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_pylab_helpers.pyi +29 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_qhull.pyi +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_text_helpers.py +82 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tight_bbox.py +84 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tight_layout.py +301 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tri.pyi +36 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_type1font.py +879 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_version.py +1 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/animation.py +1823 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/animation.pyi +217 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/artist.py +1855 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/artist.pyi +199 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/axis.py +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/axis.pyi +280 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_bases.py +0 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_bases.pyi +482 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_managers.py +387 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_managers.pyi +64 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_tools.py +998 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_tools.pyi +121 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/bezier.py +602 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/bezier.pyi +74 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/category.py +235 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/cbook.py +2419 -0
- Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/cbook.pyi +173 -0
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.py
ADDED
|
@@ -0,0 +1,1579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
An object-oriented plotting library.
|
| 3 |
+
|
| 4 |
+
A procedural interface is provided by the companion pyplot module,
|
| 5 |
+
which may be imported directly, e.g.::
|
| 6 |
+
|
| 7 |
+
import matplotlib.pyplot as plt
|
| 8 |
+
|
| 9 |
+
or using ipython::
|
| 10 |
+
|
| 11 |
+
ipython
|
| 12 |
+
|
| 13 |
+
at your terminal, followed by::
|
| 14 |
+
|
| 15 |
+
In [1]: %matplotlib
|
| 16 |
+
In [2]: import matplotlib.pyplot as plt
|
| 17 |
+
|
| 18 |
+
at the ipython shell prompt.
|
| 19 |
+
|
| 20 |
+
For the most part, direct use of the explicit object-oriented library is
|
| 21 |
+
encouraged when programming; the implicit pyplot interface is primarily for
|
| 22 |
+
working interactively. The exceptions to this suggestion are the pyplot
|
| 23 |
+
functions `.pyplot.figure`, `.pyplot.subplot`, `.pyplot.subplots`, and
|
| 24 |
+
`.pyplot.savefig`, which can greatly simplify scripting. See
|
| 25 |
+
:ref:`api_interfaces` for an explanation of the tradeoffs between the implicit
|
| 26 |
+
and explicit interfaces.
|
| 27 |
+
|
| 28 |
+
Modules include:
|
| 29 |
+
|
| 30 |
+
:mod:`matplotlib.axes`
|
| 31 |
+
The `~.axes.Axes` class. Most pyplot functions are wrappers for
|
| 32 |
+
`~.axes.Axes` methods. The axes module is the highest level of OO
|
| 33 |
+
access to the library.
|
| 34 |
+
|
| 35 |
+
:mod:`matplotlib.figure`
|
| 36 |
+
The `.Figure` class.
|
| 37 |
+
|
| 38 |
+
:mod:`matplotlib.artist`
|
| 39 |
+
The `.Artist` base class for all classes that draw things.
|
| 40 |
+
|
| 41 |
+
:mod:`matplotlib.lines`
|
| 42 |
+
The `.Line2D` class for drawing lines and markers.
|
| 43 |
+
|
| 44 |
+
:mod:`matplotlib.patches`
|
| 45 |
+
Classes for drawing polygons.
|
| 46 |
+
|
| 47 |
+
:mod:`matplotlib.text`
|
| 48 |
+
The `.Text` and `.Annotation` classes.
|
| 49 |
+
|
| 50 |
+
:mod:`matplotlib.image`
|
| 51 |
+
The `.AxesImage` and `.FigureImage` classes.
|
| 52 |
+
|
| 53 |
+
:mod:`matplotlib.collections`
|
| 54 |
+
Classes for efficient drawing of groups of lines or polygons.
|
| 55 |
+
|
| 56 |
+
:mod:`matplotlib.colors`
|
| 57 |
+
Color specifications and making colormaps.
|
| 58 |
+
|
| 59 |
+
:mod:`matplotlib.cm`
|
| 60 |
+
Colormaps, and the `.ScalarMappable` mixin class for providing color
|
| 61 |
+
mapping functionality to other classes.
|
| 62 |
+
|
| 63 |
+
:mod:`matplotlib.ticker`
|
| 64 |
+
Calculation of tick mark locations and formatting of tick labels.
|
| 65 |
+
|
| 66 |
+
:mod:`matplotlib.backends`
|
| 67 |
+
A subpackage with modules for various GUI libraries and output formats.
|
| 68 |
+
|
| 69 |
+
The base matplotlib namespace includes:
|
| 70 |
+
|
| 71 |
+
`~matplotlib.rcParams`
|
| 72 |
+
Default configuration settings; their defaults may be overridden using
|
| 73 |
+
a :file:`matplotlibrc` file.
|
| 74 |
+
|
| 75 |
+
`~matplotlib.use`
|
| 76 |
+
Setting the Matplotlib backend. This should be called before any
|
| 77 |
+
figure is created, because it is not possible to switch between
|
| 78 |
+
different GUI backends after that.
|
| 79 |
+
|
| 80 |
+
The following environment variables can be used to customize the behavior:
|
| 81 |
+
|
| 82 |
+
:envvar:`MPLBACKEND`
|
| 83 |
+
This optional variable can be set to choose the Matplotlib backend. See
|
| 84 |
+
:ref:`what-is-a-backend`.
|
| 85 |
+
|
| 86 |
+
:envvar:`MPLCONFIGDIR`
|
| 87 |
+
This is the directory used to store user customizations to
|
| 88 |
+
Matplotlib, as well as some caches to improve performance. If
|
| 89 |
+
:envvar:`MPLCONFIGDIR` is not defined, :file:`{HOME}/.config/matplotlib`
|
| 90 |
+
and :file:`{HOME}/.cache/matplotlib` are used on Linux, and
|
| 91 |
+
:file:`{HOME}/.matplotlib` on other platforms, if they are
|
| 92 |
+
writable. Otherwise, the Python standard library's `tempfile.gettempdir`
|
| 93 |
+
is used to find a base directory in which the :file:`matplotlib`
|
| 94 |
+
subdirectory is created.
|
| 95 |
+
|
| 96 |
+
Matplotlib was initially written by John D. Hunter (1968-2012) and is now
|
| 97 |
+
developed and maintained by a host of others.
|
| 98 |
+
|
| 99 |
+
Occasionally the internal documentation (python docstrings) will refer
|
| 100 |
+
to MATLAB®, a registered trademark of The MathWorks, Inc.
|
| 101 |
+
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
__all__ = [
|
| 105 |
+
"__bibtex__",
|
| 106 |
+
"__version__",
|
| 107 |
+
"__version_info__",
|
| 108 |
+
"set_loglevel",
|
| 109 |
+
"ExecutableNotFoundError",
|
| 110 |
+
"get_configdir",
|
| 111 |
+
"get_cachedir",
|
| 112 |
+
"get_data_path",
|
| 113 |
+
"matplotlib_fname",
|
| 114 |
+
"MatplotlibDeprecationWarning",
|
| 115 |
+
"RcParams",
|
| 116 |
+
"rc_params",
|
| 117 |
+
"rc_params_from_file",
|
| 118 |
+
"rcParamsDefault",
|
| 119 |
+
"rcParams",
|
| 120 |
+
"rcParamsOrig",
|
| 121 |
+
"defaultParams",
|
| 122 |
+
"rc",
|
| 123 |
+
"rcdefaults",
|
| 124 |
+
"rc_file_defaults",
|
| 125 |
+
"rc_file",
|
| 126 |
+
"rc_context",
|
| 127 |
+
"use",
|
| 128 |
+
"get_backend",
|
| 129 |
+
"interactive",
|
| 130 |
+
"is_interactive",
|
| 131 |
+
"colormaps",
|
| 132 |
+
"multivar_colormaps",
|
| 133 |
+
"bivar_colormaps",
|
| 134 |
+
"color_sequences",
|
| 135 |
+
]
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
import atexit
|
| 139 |
+
from collections import namedtuple
|
| 140 |
+
from collections.abc import MutableMapping
|
| 141 |
+
import contextlib
|
| 142 |
+
import functools
|
| 143 |
+
import importlib
|
| 144 |
+
import inspect
|
| 145 |
+
from inspect import Parameter
|
| 146 |
+
import locale
|
| 147 |
+
import logging
|
| 148 |
+
import os
|
| 149 |
+
from pathlib import Path
|
| 150 |
+
import pprint
|
| 151 |
+
import re
|
| 152 |
+
import shutil
|
| 153 |
+
import subprocess
|
| 154 |
+
import sys
|
| 155 |
+
import tempfile
|
| 156 |
+
|
| 157 |
+
from packaging.version import parse as parse_version
|
| 158 |
+
|
| 159 |
+
# cbook must import matplotlib only within function
|
| 160 |
+
# definitions, so it is safe to import from it here.
|
| 161 |
+
from . import _api, _version, cbook, _docstring, rcsetup
|
| 162 |
+
from matplotlib._api import MatplotlibDeprecationWarning
|
| 163 |
+
from matplotlib.rcsetup import cycler # noqa: F401
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
_log = logging.getLogger(__name__)
|
| 167 |
+
|
| 168 |
+
__bibtex__ = r"""@Article{Hunter:2007,
|
| 169 |
+
Author = {Hunter, J. D.},
|
| 170 |
+
Title = {Matplotlib: A 2D graphics environment},
|
| 171 |
+
Journal = {Computing in Science \& Engineering},
|
| 172 |
+
Volume = {9},
|
| 173 |
+
Number = {3},
|
| 174 |
+
Pages = {90--95},
|
| 175 |
+
abstract = {Matplotlib is a 2D graphics package used for Python
|
| 176 |
+
for application development, interactive scripting, and
|
| 177 |
+
publication-quality image generation across user
|
| 178 |
+
interfaces and operating systems.},
|
| 179 |
+
publisher = {IEEE COMPUTER SOC},
|
| 180 |
+
year = 2007
|
| 181 |
+
}"""
|
| 182 |
+
|
| 183 |
+
# modelled after sys.version_info
|
| 184 |
+
_VersionInfo = namedtuple('_VersionInfo',
|
| 185 |
+
'major, minor, micro, releaselevel, serial')
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _parse_to_version_info(version_str):
|
| 189 |
+
"""
|
| 190 |
+
Parse a version string to a namedtuple analogous to sys.version_info.
|
| 191 |
+
|
| 192 |
+
See:
|
| 193 |
+
https://packaging.pypa.io/en/latest/version.html#packaging.version.parse
|
| 194 |
+
https://docs.python.org/3/library/sys.html#sys.version_info
|
| 195 |
+
"""
|
| 196 |
+
v = parse_version(version_str)
|
| 197 |
+
if v.pre is None and v.post is None and v.dev is None:
|
| 198 |
+
return _VersionInfo(v.major, v.minor, v.micro, 'final', 0)
|
| 199 |
+
elif v.dev is not None:
|
| 200 |
+
return _VersionInfo(v.major, v.minor, v.micro, 'alpha', v.dev)
|
| 201 |
+
elif v.pre is not None:
|
| 202 |
+
releaselevel = {
|
| 203 |
+
'a': 'alpha',
|
| 204 |
+
'b': 'beta',
|
| 205 |
+
'rc': 'candidate'}.get(v.pre[0], 'alpha')
|
| 206 |
+
return _VersionInfo(v.major, v.minor, v.micro, releaselevel, v.pre[1])
|
| 207 |
+
else:
|
| 208 |
+
# fallback for v.post: guess-next-dev scheme from setuptools_scm
|
| 209 |
+
return _VersionInfo(v.major, v.minor, v.micro + 1, 'alpha', v.post)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def _get_version():
|
| 213 |
+
"""Return the version string used for __version__."""
|
| 214 |
+
# Only shell out to a git subprocess if really needed, i.e. when we are in
|
| 215 |
+
# a matplotlib git repo but not in a shallow clone, such as those used by
|
| 216 |
+
# CI, as the latter would trigger a warning from setuptools_scm.
|
| 217 |
+
root = Path(__file__).resolve().parents[2]
|
| 218 |
+
if ((root / ".matplotlib-repo").exists()
|
| 219 |
+
and (root / ".git").exists()
|
| 220 |
+
and not (root / ".git/shallow").exists()):
|
| 221 |
+
try:
|
| 222 |
+
import setuptools_scm
|
| 223 |
+
except ImportError:
|
| 224 |
+
pass
|
| 225 |
+
else:
|
| 226 |
+
return setuptools_scm.get_version(
|
| 227 |
+
root=root,
|
| 228 |
+
dist_name="matplotlib",
|
| 229 |
+
version_scheme="release-branch-semver",
|
| 230 |
+
local_scheme="node-and-date",
|
| 231 |
+
fallback_version=_version.version,
|
| 232 |
+
)
|
| 233 |
+
# Get the version from the _version.py file if not in repo or setuptools_scm is
|
| 234 |
+
# unavailable.
|
| 235 |
+
return _version.version
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
@_api.caching_module_getattr
|
| 239 |
+
class __getattr__:
|
| 240 |
+
__version__ = property(lambda self: _get_version())
|
| 241 |
+
__version_info__ = property(
|
| 242 |
+
lambda self: _parse_to_version_info(self.__version__))
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def _check_versions():
|
| 246 |
+
|
| 247 |
+
# Quickfix to ensure Microsoft Visual C++ redistributable
|
| 248 |
+
# DLLs are loaded before importing kiwisolver
|
| 249 |
+
from . import ft2font # noqa: F401
|
| 250 |
+
|
| 251 |
+
for modname, minver in [
|
| 252 |
+
("cycler", "0.10"),
|
| 253 |
+
("dateutil", "2.7"),
|
| 254 |
+
("kiwisolver", "1.3.1"),
|
| 255 |
+
("numpy", "1.23"),
|
| 256 |
+
("pyparsing", "2.3.1"),
|
| 257 |
+
]:
|
| 258 |
+
module = importlib.import_module(modname)
|
| 259 |
+
if parse_version(module.__version__) < parse_version(minver):
|
| 260 |
+
raise ImportError(f"Matplotlib requires {modname}>={minver}; "
|
| 261 |
+
f"you have {module.__version__}")
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
_check_versions()
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# The decorator ensures this always returns the same handler (and it is only
|
| 268 |
+
# attached once).
|
| 269 |
+
@functools.cache
|
| 270 |
+
def _ensure_handler():
|
| 271 |
+
"""
|
| 272 |
+
The first time this function is called, attach a `StreamHandler` using the
|
| 273 |
+
same format as `logging.basicConfig` to the Matplotlib root logger.
|
| 274 |
+
|
| 275 |
+
Return this handler every time this function is called.
|
| 276 |
+
"""
|
| 277 |
+
handler = logging.StreamHandler()
|
| 278 |
+
handler.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
|
| 279 |
+
_log.addHandler(handler)
|
| 280 |
+
return handler
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
def set_loglevel(level):
|
| 284 |
+
"""
|
| 285 |
+
Configure Matplotlib's logging levels.
|
| 286 |
+
|
| 287 |
+
Matplotlib uses the standard library `logging` framework under the root
|
| 288 |
+
logger 'matplotlib'. This is a helper function to:
|
| 289 |
+
|
| 290 |
+
- set Matplotlib's root logger level
|
| 291 |
+
- set the root logger handler's level, creating the handler
|
| 292 |
+
if it does not exist yet
|
| 293 |
+
|
| 294 |
+
Typically, one should call ``set_loglevel("info")`` or
|
| 295 |
+
``set_loglevel("debug")`` to get additional debugging information.
|
| 296 |
+
|
| 297 |
+
Users or applications that are installing their own logging handlers
|
| 298 |
+
may want to directly manipulate ``logging.getLogger('matplotlib')`` rather
|
| 299 |
+
than use this function.
|
| 300 |
+
|
| 301 |
+
Parameters
|
| 302 |
+
----------
|
| 303 |
+
level : {"notset", "debug", "info", "warning", "error", "critical"}
|
| 304 |
+
The log level of the handler.
|
| 305 |
+
|
| 306 |
+
Notes
|
| 307 |
+
-----
|
| 308 |
+
The first time this function is called, an additional handler is attached
|
| 309 |
+
to Matplotlib's root handler; this handler is reused every time and this
|
| 310 |
+
function simply manipulates the logger and handler's level.
|
| 311 |
+
|
| 312 |
+
"""
|
| 313 |
+
_log.setLevel(level.upper())
|
| 314 |
+
_ensure_handler().setLevel(level.upper())
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
def _logged_cached(fmt, func=None):
|
| 318 |
+
"""
|
| 319 |
+
Decorator that logs a function's return value, and memoizes that value.
|
| 320 |
+
|
| 321 |
+
After ::
|
| 322 |
+
|
| 323 |
+
@_logged_cached(fmt)
|
| 324 |
+
def func(): ...
|
| 325 |
+
|
| 326 |
+
the first call to *func* will log its return value at the DEBUG level using
|
| 327 |
+
%-format string *fmt*, and memoize it; later calls to *func* will directly
|
| 328 |
+
return that value.
|
| 329 |
+
"""
|
| 330 |
+
if func is None: # Return the actual decorator.
|
| 331 |
+
return functools.partial(_logged_cached, fmt)
|
| 332 |
+
|
| 333 |
+
called = False
|
| 334 |
+
ret = None
|
| 335 |
+
|
| 336 |
+
@functools.wraps(func)
|
| 337 |
+
def wrapper(**kwargs):
|
| 338 |
+
nonlocal called, ret
|
| 339 |
+
if not called:
|
| 340 |
+
ret = func(**kwargs)
|
| 341 |
+
called = True
|
| 342 |
+
_log.debug(fmt, ret)
|
| 343 |
+
return ret
|
| 344 |
+
|
| 345 |
+
return wrapper
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
_ExecInfo = namedtuple("_ExecInfo", "executable raw_version version")
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
class ExecutableNotFoundError(FileNotFoundError):
|
| 352 |
+
"""
|
| 353 |
+
Error raised when an executable that Matplotlib optionally
|
| 354 |
+
depends on can't be found.
|
| 355 |
+
"""
|
| 356 |
+
pass
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
@functools.cache
|
| 360 |
+
def _get_executable_info(name):
|
| 361 |
+
"""
|
| 362 |
+
Get the version of some executable that Matplotlib optionally depends on.
|
| 363 |
+
|
| 364 |
+
.. warning::
|
| 365 |
+
The list of executables that this function supports is set according to
|
| 366 |
+
Matplotlib's internal needs, and may change without notice.
|
| 367 |
+
|
| 368 |
+
Parameters
|
| 369 |
+
----------
|
| 370 |
+
name : str
|
| 371 |
+
The executable to query. The following values are currently supported:
|
| 372 |
+
"dvipng", "gs", "inkscape", "magick", "pdftocairo", "pdftops". This
|
| 373 |
+
list is subject to change without notice.
|
| 374 |
+
|
| 375 |
+
Returns
|
| 376 |
+
-------
|
| 377 |
+
tuple
|
| 378 |
+
A namedtuple with fields ``executable`` (`str`) and ``version``
|
| 379 |
+
(`packaging.Version`, or ``None`` if the version cannot be determined).
|
| 380 |
+
|
| 381 |
+
Raises
|
| 382 |
+
------
|
| 383 |
+
ExecutableNotFoundError
|
| 384 |
+
If the executable is not found or older than the oldest version
|
| 385 |
+
supported by Matplotlib. For debugging purposes, it is also
|
| 386 |
+
possible to "hide" an executable from Matplotlib by adding it to the
|
| 387 |
+
:envvar:`_MPLHIDEEXECUTABLES` environment variable (a comma-separated
|
| 388 |
+
list), which must be set prior to any calls to this function.
|
| 389 |
+
ValueError
|
| 390 |
+
If the executable is not one that we know how to query.
|
| 391 |
+
"""
|
| 392 |
+
|
| 393 |
+
def impl(args, regex, min_ver=None, ignore_exit_code=False):
|
| 394 |
+
# Execute the subprocess specified by args; capture stdout and stderr.
|
| 395 |
+
# Search for a regex match in the output; if the match succeeds, the
|
| 396 |
+
# first group of the match is the version.
|
| 397 |
+
# Return an _ExecInfo if the executable exists, and has a version of
|
| 398 |
+
# at least min_ver (if set); else, raise ExecutableNotFoundError.
|
| 399 |
+
try:
|
| 400 |
+
output = subprocess.check_output(
|
| 401 |
+
args, stderr=subprocess.STDOUT,
|
| 402 |
+
text=True, errors="replace", timeout=30)
|
| 403 |
+
except subprocess.CalledProcessError as _cpe:
|
| 404 |
+
if ignore_exit_code:
|
| 405 |
+
output = _cpe.output
|
| 406 |
+
else:
|
| 407 |
+
raise ExecutableNotFoundError(str(_cpe)) from _cpe
|
| 408 |
+
except subprocess.TimeoutExpired as _te:
|
| 409 |
+
msg = f"Timed out running {cbook._pformat_subprocess(args)}"
|
| 410 |
+
raise ExecutableNotFoundError(msg) from _te
|
| 411 |
+
except OSError as _ose:
|
| 412 |
+
raise ExecutableNotFoundError(str(_ose)) from _ose
|
| 413 |
+
match = re.search(regex, output)
|
| 414 |
+
if match:
|
| 415 |
+
raw_version = match.group(1)
|
| 416 |
+
version = parse_version(raw_version)
|
| 417 |
+
if min_ver is not None and version < parse_version(min_ver):
|
| 418 |
+
raise ExecutableNotFoundError(
|
| 419 |
+
f"You have {args[0]} version {version} but the minimum "
|
| 420 |
+
f"version supported by Matplotlib is {min_ver}")
|
| 421 |
+
return _ExecInfo(args[0], raw_version, version)
|
| 422 |
+
else:
|
| 423 |
+
raise ExecutableNotFoundError(
|
| 424 |
+
f"Failed to determine the version of {args[0]} from "
|
| 425 |
+
f"{' '.join(args)}, which output {output}")
|
| 426 |
+
|
| 427 |
+
if name in os.environ.get("_MPLHIDEEXECUTABLES", "").split(","):
|
| 428 |
+
raise ExecutableNotFoundError(f"{name} was hidden")
|
| 429 |
+
|
| 430 |
+
if name == "dvipng":
|
| 431 |
+
return impl(["dvipng", "-version"], "(?m)^dvipng(?: .*)? (.+)", "1.6")
|
| 432 |
+
elif name == "gs":
|
| 433 |
+
execs = (["gswin32c", "gswin64c", "mgs", "gs"] # "mgs" for miktex.
|
| 434 |
+
if sys.platform == "win32" else
|
| 435 |
+
["gs"])
|
| 436 |
+
for e in execs:
|
| 437 |
+
try:
|
| 438 |
+
return impl([e, "--version"], "(.*)", "9")
|
| 439 |
+
except ExecutableNotFoundError:
|
| 440 |
+
pass
|
| 441 |
+
message = "Failed to find a Ghostscript installation"
|
| 442 |
+
raise ExecutableNotFoundError(message)
|
| 443 |
+
elif name == "inkscape":
|
| 444 |
+
try:
|
| 445 |
+
# Try headless option first (needed for Inkscape version < 1.0):
|
| 446 |
+
return impl(["inkscape", "--without-gui", "-V"],
|
| 447 |
+
"Inkscape ([^ ]*)")
|
| 448 |
+
except ExecutableNotFoundError:
|
| 449 |
+
pass # Suppress exception chaining.
|
| 450 |
+
# If --without-gui is not accepted, we may be using Inkscape >= 1.0 so
|
| 451 |
+
# try without it:
|
| 452 |
+
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
|
| 453 |
+
elif name == "magick":
|
| 454 |
+
if sys.platform == "win32":
|
| 455 |
+
# Check the registry to avoid confusing ImageMagick's convert with
|
| 456 |
+
# Windows's builtin convert.exe.
|
| 457 |
+
import winreg
|
| 458 |
+
binpath = ""
|
| 459 |
+
for flag in [0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY]:
|
| 460 |
+
try:
|
| 461 |
+
with winreg.OpenKeyEx(
|
| 462 |
+
winreg.HKEY_LOCAL_MACHINE,
|
| 463 |
+
r"Software\Imagemagick\Current",
|
| 464 |
+
0, winreg.KEY_QUERY_VALUE | flag) as hkey:
|
| 465 |
+
binpath = winreg.QueryValueEx(hkey, "BinPath")[0]
|
| 466 |
+
except OSError:
|
| 467 |
+
pass
|
| 468 |
+
path = None
|
| 469 |
+
if binpath:
|
| 470 |
+
for name in ["convert.exe", "magick.exe"]:
|
| 471 |
+
candidate = Path(binpath, name)
|
| 472 |
+
if candidate.exists():
|
| 473 |
+
path = str(candidate)
|
| 474 |
+
break
|
| 475 |
+
if path is None:
|
| 476 |
+
raise ExecutableNotFoundError(
|
| 477 |
+
"Failed to find an ImageMagick installation")
|
| 478 |
+
else:
|
| 479 |
+
path = "convert"
|
| 480 |
+
info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
|
| 481 |
+
if info.raw_version == "7.0.10-34":
|
| 482 |
+
# https://github.com/ImageMagick/ImageMagick/issues/2720
|
| 483 |
+
raise ExecutableNotFoundError(
|
| 484 |
+
f"You have ImageMagick {info.version}, which is unsupported")
|
| 485 |
+
return info
|
| 486 |
+
elif name == "pdftocairo":
|
| 487 |
+
return impl(["pdftocairo", "-v"], "pdftocairo version (.*)")
|
| 488 |
+
elif name == "pdftops":
|
| 489 |
+
info = impl(["pdftops", "-v"], "^pdftops version (.*)",
|
| 490 |
+
ignore_exit_code=True)
|
| 491 |
+
if info and not (
|
| 492 |
+
3 <= info.version.major or
|
| 493 |
+
# poppler version numbers.
|
| 494 |
+
parse_version("0.9") <= info.version < parse_version("1.0")):
|
| 495 |
+
raise ExecutableNotFoundError(
|
| 496 |
+
f"You have pdftops version {info.version} but the minimum "
|
| 497 |
+
f"version supported by Matplotlib is 3.0")
|
| 498 |
+
return info
|
| 499 |
+
else:
|
| 500 |
+
raise ValueError(f"Unknown executable: {name!r}")
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
def _get_xdg_config_dir():
|
| 504 |
+
"""
|
| 505 |
+
Return the XDG configuration directory, according to the XDG base
|
| 506 |
+
directory spec:
|
| 507 |
+
|
| 508 |
+
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
| 509 |
+
"""
|
| 510 |
+
return os.environ.get('XDG_CONFIG_HOME') or str(Path.home() / ".config")
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
def _get_xdg_cache_dir():
|
| 514 |
+
"""
|
| 515 |
+
Return the XDG cache directory, according to the XDG base directory spec:
|
| 516 |
+
|
| 517 |
+
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
| 518 |
+
"""
|
| 519 |
+
return os.environ.get('XDG_CACHE_HOME') or str(Path.home() / ".cache")
|
| 520 |
+
|
| 521 |
+
|
| 522 |
+
def _get_config_or_cache_dir(xdg_base_getter):
|
| 523 |
+
configdir = os.environ.get('MPLCONFIGDIR')
|
| 524 |
+
if configdir:
|
| 525 |
+
configdir = Path(configdir)
|
| 526 |
+
elif sys.platform.startswith(('linux', 'freebsd')):
|
| 527 |
+
# Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first,
|
| 528 |
+
# as _xdg_base_getter can throw.
|
| 529 |
+
configdir = Path(xdg_base_getter(), "matplotlib")
|
| 530 |
+
else:
|
| 531 |
+
configdir = Path.home() / ".matplotlib"
|
| 532 |
+
# Resolve the path to handle potential issues with inaccessible symlinks.
|
| 533 |
+
configdir = configdir.resolve()
|
| 534 |
+
try:
|
| 535 |
+
configdir.mkdir(parents=True, exist_ok=True)
|
| 536 |
+
except OSError as exc:
|
| 537 |
+
_log.warning("mkdir -p failed for path %s: %s", configdir, exc)
|
| 538 |
+
else:
|
| 539 |
+
if os.access(str(configdir), os.W_OK) and configdir.is_dir():
|
| 540 |
+
return str(configdir)
|
| 541 |
+
_log.warning("%s is not a writable directory", configdir)
|
| 542 |
+
# If the config or cache directory cannot be created or is not a writable
|
| 543 |
+
# directory, create a temporary one.
|
| 544 |
+
try:
|
| 545 |
+
tmpdir = tempfile.mkdtemp(prefix="matplotlib-")
|
| 546 |
+
except OSError as exc:
|
| 547 |
+
raise OSError(
|
| 548 |
+
f"Matplotlib requires access to a writable cache directory, but there "
|
| 549 |
+
f"was an issue with the default path ({configdir}), and a temporary "
|
| 550 |
+
f"directory could not be created; set the MPLCONFIGDIR environment "
|
| 551 |
+
f"variable to a writable directory") from exc
|
| 552 |
+
os.environ["MPLCONFIGDIR"] = tmpdir
|
| 553 |
+
atexit.register(shutil.rmtree, tmpdir)
|
| 554 |
+
_log.warning(
|
| 555 |
+
"Matplotlib created a temporary cache directory at %s because there was "
|
| 556 |
+
"an issue with the default path (%s); it is highly recommended to set the "
|
| 557 |
+
"MPLCONFIGDIR environment variable to a writable directory, in particular to "
|
| 558 |
+
"speed up the import of Matplotlib and to better support multiprocessing.",
|
| 559 |
+
tmpdir, configdir)
|
| 560 |
+
return tmpdir
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
@_logged_cached('CONFIGDIR=%s')
|
| 564 |
+
def get_configdir():
|
| 565 |
+
"""
|
| 566 |
+
Return the string path of the configuration directory.
|
| 567 |
+
|
| 568 |
+
The directory is chosen as follows:
|
| 569 |
+
|
| 570 |
+
1. If the MPLCONFIGDIR environment variable is supplied, choose that.
|
| 571 |
+
2. On Linux, follow the XDG specification and look first in
|
| 572 |
+
``$XDG_CONFIG_HOME``, if defined, or ``$HOME/.config``. On other
|
| 573 |
+
platforms, choose ``$HOME/.matplotlib``.
|
| 574 |
+
3. If the chosen directory exists and is writable, use that as the
|
| 575 |
+
configuration directory.
|
| 576 |
+
4. Else, create a temporary directory, and use it as the configuration
|
| 577 |
+
directory.
|
| 578 |
+
"""
|
| 579 |
+
return _get_config_or_cache_dir(_get_xdg_config_dir)
|
| 580 |
+
|
| 581 |
+
|
| 582 |
+
@_logged_cached('CACHEDIR=%s')
|
| 583 |
+
def get_cachedir():
|
| 584 |
+
"""
|
| 585 |
+
Return the string path of the cache directory.
|
| 586 |
+
|
| 587 |
+
The procedure used to find the directory is the same as for
|
| 588 |
+
`get_configdir`, except using ``$XDG_CACHE_HOME``/``$HOME/.cache`` instead.
|
| 589 |
+
"""
|
| 590 |
+
return _get_config_or_cache_dir(_get_xdg_cache_dir)
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
@_logged_cached('matplotlib data path: %s')
|
| 594 |
+
def get_data_path():
|
| 595 |
+
"""Return the path to Matplotlib data."""
|
| 596 |
+
return str(Path(__file__).with_name("mpl-data"))
|
| 597 |
+
|
| 598 |
+
|
| 599 |
+
def matplotlib_fname():
|
| 600 |
+
"""
|
| 601 |
+
Get the location of the config file.
|
| 602 |
+
|
| 603 |
+
The file location is determined in the following order
|
| 604 |
+
|
| 605 |
+
- ``$PWD/matplotlibrc``
|
| 606 |
+
- ``$MATPLOTLIBRC`` if it is not a directory
|
| 607 |
+
- ``$MATPLOTLIBRC/matplotlibrc``
|
| 608 |
+
- ``$MPLCONFIGDIR/matplotlibrc``
|
| 609 |
+
- On Linux,
|
| 610 |
+
- ``$XDG_CONFIG_HOME/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
|
| 611 |
+
is defined)
|
| 612 |
+
- or ``$HOME/.config/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
|
| 613 |
+
is not defined)
|
| 614 |
+
- On other platforms,
|
| 615 |
+
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
|
| 616 |
+
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
|
| 617 |
+
exist.
|
| 618 |
+
"""
|
| 619 |
+
|
| 620 |
+
def gen_candidates():
|
| 621 |
+
# rely on down-stream code to make absolute. This protects us
|
| 622 |
+
# from having to directly get the current working directory
|
| 623 |
+
# which can fail if the user has ended up with a cwd that is
|
| 624 |
+
# non-existent.
|
| 625 |
+
yield 'matplotlibrc'
|
| 626 |
+
try:
|
| 627 |
+
matplotlibrc = os.environ['MATPLOTLIBRC']
|
| 628 |
+
except KeyError:
|
| 629 |
+
pass
|
| 630 |
+
else:
|
| 631 |
+
yield matplotlibrc
|
| 632 |
+
yield os.path.join(matplotlibrc, 'matplotlibrc')
|
| 633 |
+
yield os.path.join(get_configdir(), 'matplotlibrc')
|
| 634 |
+
yield os.path.join(get_data_path(), 'matplotlibrc')
|
| 635 |
+
|
| 636 |
+
for fname in gen_candidates():
|
| 637 |
+
if os.path.exists(fname) and not os.path.isdir(fname):
|
| 638 |
+
return fname
|
| 639 |
+
|
| 640 |
+
raise RuntimeError("Could not find matplotlibrc file; your Matplotlib "
|
| 641 |
+
"install is broken")
|
| 642 |
+
|
| 643 |
+
|
| 644 |
+
# rcParams deprecated and automatically mapped to another key.
|
| 645 |
+
# Values are tuples of (version, new_name, f_old2new, f_new2old).
|
| 646 |
+
_deprecated_map = {}
|
| 647 |
+
# rcParams deprecated; some can manually be mapped to another key.
|
| 648 |
+
# Values are tuples of (version, new_name_or_None).
|
| 649 |
+
_deprecated_ignore_map = {}
|
| 650 |
+
# rcParams deprecated; can use None to suppress warnings; remain actually
|
| 651 |
+
# listed in the rcParams.
|
| 652 |
+
# Values are tuples of (version,)
|
| 653 |
+
_deprecated_remain_as_none = {}
|
| 654 |
+
|
| 655 |
+
|
| 656 |
+
@_docstring.Substitution(
|
| 657 |
+
"\n".join(map("- {}".format, sorted(rcsetup._validators, key=str.lower)))
|
| 658 |
+
)
|
| 659 |
+
class RcParams(MutableMapping, dict):
|
| 660 |
+
"""
|
| 661 |
+
A dict-like key-value store for config parameters, including validation.
|
| 662 |
+
|
| 663 |
+
Validating functions are defined and associated with rc parameters in
|
| 664 |
+
:mod:`matplotlib.rcsetup`.
|
| 665 |
+
|
| 666 |
+
The list of rcParams is:
|
| 667 |
+
|
| 668 |
+
%s
|
| 669 |
+
|
| 670 |
+
See Also
|
| 671 |
+
--------
|
| 672 |
+
:ref:`customizing-with-matplotlibrc-files`
|
| 673 |
+
"""
|
| 674 |
+
|
| 675 |
+
validate = rcsetup._validators
|
| 676 |
+
|
| 677 |
+
# validate values on the way in
|
| 678 |
+
def __init__(self, *args, **kwargs):
|
| 679 |
+
self.update(*args, **kwargs)
|
| 680 |
+
|
| 681 |
+
def _set(self, key, val):
|
| 682 |
+
"""
|
| 683 |
+
Directly write data bypassing deprecation and validation logic.
|
| 684 |
+
|
| 685 |
+
Notes
|
| 686 |
+
-----
|
| 687 |
+
As end user or downstream library you almost always should use
|
| 688 |
+
``rcParams[key] = val`` and not ``_set()``.
|
| 689 |
+
|
| 690 |
+
There are only very few special cases that need direct data access.
|
| 691 |
+
These cases previously used ``dict.__setitem__(rcParams, key, val)``,
|
| 692 |
+
which is now deprecated and replaced by ``rcParams._set(key, val)``.
|
| 693 |
+
|
| 694 |
+
Even though private, we guarantee API stability for ``rcParams._set``,
|
| 695 |
+
i.e. it is subject to Matplotlib's API and deprecation policy.
|
| 696 |
+
|
| 697 |
+
:meta public:
|
| 698 |
+
"""
|
| 699 |
+
dict.__setitem__(self, key, val)
|
| 700 |
+
|
| 701 |
+
def _get(self, key):
|
| 702 |
+
"""
|
| 703 |
+
Directly read data bypassing deprecation, backend and validation
|
| 704 |
+
logic.
|
| 705 |
+
|
| 706 |
+
Notes
|
| 707 |
+
-----
|
| 708 |
+
As end user or downstream library you almost always should use
|
| 709 |
+
``val = rcParams[key]`` and not ``_get()``.
|
| 710 |
+
|
| 711 |
+
There are only very few special cases that need direct data access.
|
| 712 |
+
These cases previously used ``dict.__getitem__(rcParams, key, val)``,
|
| 713 |
+
which is now deprecated and replaced by ``rcParams._get(key)``.
|
| 714 |
+
|
| 715 |
+
Even though private, we guarantee API stability for ``rcParams._get``,
|
| 716 |
+
i.e. it is subject to Matplotlib's API and deprecation policy.
|
| 717 |
+
|
| 718 |
+
:meta public:
|
| 719 |
+
"""
|
| 720 |
+
return dict.__getitem__(self, key)
|
| 721 |
+
|
| 722 |
+
def _update_raw(self, other_params):
|
| 723 |
+
"""
|
| 724 |
+
Directly update the data from *other_params*, bypassing deprecation,
|
| 725 |
+
backend and validation logic on both sides.
|
| 726 |
+
|
| 727 |
+
This ``rcParams._update_raw(params)`` replaces the previous pattern
|
| 728 |
+
``dict.update(rcParams, params)``.
|
| 729 |
+
|
| 730 |
+
Parameters
|
| 731 |
+
----------
|
| 732 |
+
other_params : dict or `.RcParams`
|
| 733 |
+
The input mapping from which to update.
|
| 734 |
+
"""
|
| 735 |
+
if isinstance(other_params, RcParams):
|
| 736 |
+
other_params = dict.items(other_params)
|
| 737 |
+
dict.update(self, other_params)
|
| 738 |
+
|
| 739 |
+
def _ensure_has_backend(self):
|
| 740 |
+
"""
|
| 741 |
+
Ensure that a "backend" entry exists.
|
| 742 |
+
|
| 743 |
+
Normally, the default matplotlibrc file contains *no* entry for "backend" (the
|
| 744 |
+
corresponding line starts with ##, not #; we fill in _auto_backend_sentinel
|
| 745 |
+
in that case. However, packagers can set a different default backend
|
| 746 |
+
(resulting in a normal `#backend: foo` line) in which case we should *not*
|
| 747 |
+
fill in _auto_backend_sentinel.
|
| 748 |
+
"""
|
| 749 |
+
dict.setdefault(self, "backend", rcsetup._auto_backend_sentinel)
|
| 750 |
+
|
| 751 |
+
def __setitem__(self, key, val):
|
| 752 |
+
try:
|
| 753 |
+
if key in _deprecated_map:
|
| 754 |
+
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
|
| 755 |
+
_api.warn_deprecated(
|
| 756 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 757 |
+
key = alt_key
|
| 758 |
+
val = alt_val(val)
|
| 759 |
+
elif key in _deprecated_remain_as_none and val is not None:
|
| 760 |
+
version, = _deprecated_remain_as_none[key]
|
| 761 |
+
_api.warn_deprecated(version, name=key, obj_type="rcparam")
|
| 762 |
+
elif key in _deprecated_ignore_map:
|
| 763 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 764 |
+
_api.warn_deprecated(
|
| 765 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 766 |
+
return
|
| 767 |
+
elif key == 'backend':
|
| 768 |
+
if val is rcsetup._auto_backend_sentinel:
|
| 769 |
+
if 'backend' in self:
|
| 770 |
+
return
|
| 771 |
+
try:
|
| 772 |
+
cval = self.validate[key](val)
|
| 773 |
+
except ValueError as ve:
|
| 774 |
+
raise ValueError(f"Key {key}: {ve}") from None
|
| 775 |
+
self._set(key, cval)
|
| 776 |
+
except KeyError as err:
|
| 777 |
+
raise KeyError(
|
| 778 |
+
f"{key} is not a valid rc parameter (see rcParams.keys() for "
|
| 779 |
+
f"a list of valid parameters)") from err
|
| 780 |
+
|
| 781 |
+
def __getitem__(self, key):
|
| 782 |
+
if key in _deprecated_map:
|
| 783 |
+
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
|
| 784 |
+
_api.warn_deprecated(
|
| 785 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 786 |
+
return inverse_alt(self._get(alt_key))
|
| 787 |
+
|
| 788 |
+
elif key in _deprecated_ignore_map:
|
| 789 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 790 |
+
_api.warn_deprecated(
|
| 791 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 792 |
+
return self._get(alt_key) if alt_key else None
|
| 793 |
+
|
| 794 |
+
# In theory, this should only ever be used after the global rcParams
|
| 795 |
+
# has been set up, but better be safe e.g. in presence of breakpoints.
|
| 796 |
+
elif key == "backend" and self is globals().get("rcParams"):
|
| 797 |
+
val = self._get(key)
|
| 798 |
+
if val is rcsetup._auto_backend_sentinel:
|
| 799 |
+
from matplotlib import pyplot as plt
|
| 800 |
+
plt.switch_backend(rcsetup._auto_backend_sentinel)
|
| 801 |
+
|
| 802 |
+
return self._get(key)
|
| 803 |
+
|
| 804 |
+
def _get_backend_or_none(self):
|
| 805 |
+
"""Get the requested backend, if any, without triggering resolution."""
|
| 806 |
+
backend = self._get("backend")
|
| 807 |
+
return None if backend is rcsetup._auto_backend_sentinel else backend
|
| 808 |
+
|
| 809 |
+
def __repr__(self):
|
| 810 |
+
class_name = self.__class__.__name__
|
| 811 |
+
indent = len(class_name) + 1
|
| 812 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 813 |
+
repr_split = pprint.pformat(dict(self), indent=1,
|
| 814 |
+
width=80 - indent).split('\n')
|
| 815 |
+
repr_indented = ('\n' + ' ' * indent).join(repr_split)
|
| 816 |
+
return f'{class_name}({repr_indented})'
|
| 817 |
+
|
| 818 |
+
def __str__(self):
|
| 819 |
+
return '\n'.join(map('{0[0]}: {0[1]}'.format, sorted(self.items())))
|
| 820 |
+
|
| 821 |
+
def __iter__(self):
|
| 822 |
+
"""Yield sorted list of keys."""
|
| 823 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 824 |
+
yield from sorted(dict.__iter__(self))
|
| 825 |
+
|
| 826 |
+
def __len__(self):
|
| 827 |
+
return dict.__len__(self)
|
| 828 |
+
|
| 829 |
+
def find_all(self, pattern):
|
| 830 |
+
"""
|
| 831 |
+
Return the subset of this RcParams dictionary whose keys match,
|
| 832 |
+
using :func:`re.search`, the given ``pattern``.
|
| 833 |
+
|
| 834 |
+
.. note::
|
| 835 |
+
|
| 836 |
+
Changes to the returned dictionary are *not* propagated to
|
| 837 |
+
the parent RcParams dictionary.
|
| 838 |
+
|
| 839 |
+
"""
|
| 840 |
+
pattern_re = re.compile(pattern)
|
| 841 |
+
return RcParams((key, value)
|
| 842 |
+
for key, value in self.items()
|
| 843 |
+
if pattern_re.search(key))
|
| 844 |
+
|
| 845 |
+
def copy(self):
|
| 846 |
+
"""Copy this RcParams instance."""
|
| 847 |
+
rccopy = RcParams()
|
| 848 |
+
for k in self: # Skip deprecations and revalidation.
|
| 849 |
+
rccopy._set(k, self._get(k))
|
| 850 |
+
return rccopy
|
| 851 |
+
|
| 852 |
+
|
| 853 |
+
def rc_params(fail_on_error=False):
|
| 854 |
+
"""Construct a `RcParams` instance from the default Matplotlib rc file."""
|
| 855 |
+
return rc_params_from_file(matplotlib_fname(), fail_on_error)
|
| 856 |
+
|
| 857 |
+
|
| 858 |
+
@functools.cache
|
| 859 |
+
def _get_ssl_context():
|
| 860 |
+
try:
|
| 861 |
+
import certifi
|
| 862 |
+
except ImportError:
|
| 863 |
+
_log.debug("Could not import certifi.")
|
| 864 |
+
return None
|
| 865 |
+
import ssl
|
| 866 |
+
return ssl.create_default_context(cafile=certifi.where())
|
| 867 |
+
|
| 868 |
+
|
| 869 |
+
@contextlib.contextmanager
|
| 870 |
+
def _open_file_or_url(fname):
|
| 871 |
+
if (isinstance(fname, str)
|
| 872 |
+
and fname.startswith(('http://', 'https://', 'ftp://', 'file:'))):
|
| 873 |
+
import urllib.request
|
| 874 |
+
ssl_ctx = _get_ssl_context()
|
| 875 |
+
if ssl_ctx is None:
|
| 876 |
+
_log.debug(
|
| 877 |
+
"Could not get certifi ssl context, https may not work."
|
| 878 |
+
)
|
| 879 |
+
with urllib.request.urlopen(fname, context=ssl_ctx) as f:
|
| 880 |
+
yield (line.decode('utf-8') for line in f)
|
| 881 |
+
else:
|
| 882 |
+
fname = os.path.expanduser(fname)
|
| 883 |
+
with open(fname, encoding='utf-8') as f:
|
| 884 |
+
yield f
|
| 885 |
+
|
| 886 |
+
|
| 887 |
+
def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):
|
| 888 |
+
"""
|
| 889 |
+
Construct a `RcParams` instance from file *fname*.
|
| 890 |
+
|
| 891 |
+
Unlike `rc_params_from_file`, the configuration class only contains the
|
| 892 |
+
parameters specified in the file (i.e. default values are not filled in).
|
| 893 |
+
|
| 894 |
+
Parameters
|
| 895 |
+
----------
|
| 896 |
+
fname : path-like
|
| 897 |
+
The loaded file.
|
| 898 |
+
transform : callable, default: the identity function
|
| 899 |
+
A function called on each individual line of the file to transform it,
|
| 900 |
+
before further parsing.
|
| 901 |
+
fail_on_error : bool, default: False
|
| 902 |
+
Whether invalid entries should result in an exception or a warning.
|
| 903 |
+
"""
|
| 904 |
+
import matplotlib as mpl
|
| 905 |
+
rc_temp = {}
|
| 906 |
+
with _open_file_or_url(fname) as fd:
|
| 907 |
+
try:
|
| 908 |
+
for line_no, line in enumerate(fd, 1):
|
| 909 |
+
line = transform(line)
|
| 910 |
+
strippedline = cbook._strip_comment(line)
|
| 911 |
+
if not strippedline:
|
| 912 |
+
continue
|
| 913 |
+
tup = strippedline.split(':', 1)
|
| 914 |
+
if len(tup) != 2:
|
| 915 |
+
_log.warning('Missing colon in file %r, line %d (%r)',
|
| 916 |
+
fname, line_no, line.rstrip('\n'))
|
| 917 |
+
continue
|
| 918 |
+
key, val = tup
|
| 919 |
+
key = key.strip()
|
| 920 |
+
val = val.strip()
|
| 921 |
+
if val.startswith('"') and val.endswith('"'):
|
| 922 |
+
val = val[1:-1] # strip double quotes
|
| 923 |
+
if key in rc_temp:
|
| 924 |
+
_log.warning('Duplicate key in file %r, line %d (%r)',
|
| 925 |
+
fname, line_no, line.rstrip('\n'))
|
| 926 |
+
rc_temp[key] = (val, line, line_no)
|
| 927 |
+
except UnicodeDecodeError:
|
| 928 |
+
_log.warning('Cannot decode configuration file %r as utf-8.',
|
| 929 |
+
fname)
|
| 930 |
+
raise
|
| 931 |
+
|
| 932 |
+
config = RcParams()
|
| 933 |
+
|
| 934 |
+
for key, (val, line, line_no) in rc_temp.items():
|
| 935 |
+
if key in rcsetup._validators:
|
| 936 |
+
if fail_on_error:
|
| 937 |
+
config[key] = val # try to convert to proper type or raise
|
| 938 |
+
else:
|
| 939 |
+
try:
|
| 940 |
+
config[key] = val # try to convert to proper type or skip
|
| 941 |
+
except Exception as msg:
|
| 942 |
+
_log.warning('Bad value in file %r, line %d (%r): %s',
|
| 943 |
+
fname, line_no, line.rstrip('\n'), msg)
|
| 944 |
+
elif key in _deprecated_ignore_map:
|
| 945 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 946 |
+
_api.warn_deprecated(
|
| 947 |
+
version, name=key, alternative=alt_key, obj_type='rcparam',
|
| 948 |
+
addendum="Please update your matplotlibrc.")
|
| 949 |
+
else:
|
| 950 |
+
# __version__ must be looked up as an attribute to trigger the
|
| 951 |
+
# module-level __getattr__.
|
| 952 |
+
version = ('main' if '.post' in mpl.__version__
|
| 953 |
+
else f'v{mpl.__version__}')
|
| 954 |
+
_log.warning("""
|
| 955 |
+
Bad key %(key)s in file %(fname)s, line %(line_no)s (%(line)r)
|
| 956 |
+
You probably need to get an updated matplotlibrc file from
|
| 957 |
+
https://github.com/matplotlib/matplotlib/blob/%(version)s/lib/matplotlib/mpl-data/matplotlibrc
|
| 958 |
+
or from the matplotlib source distribution""",
|
| 959 |
+
dict(key=key, fname=fname, line_no=line_no,
|
| 960 |
+
line=line.rstrip('\n'), version=version))
|
| 961 |
+
return config
|
| 962 |
+
|
| 963 |
+
|
| 964 |
+
def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
|
| 965 |
+
"""
|
| 966 |
+
Construct a `RcParams` from file *fname*.
|
| 967 |
+
|
| 968 |
+
Parameters
|
| 969 |
+
----------
|
| 970 |
+
fname : str or path-like
|
| 971 |
+
A file with Matplotlib rc settings.
|
| 972 |
+
fail_on_error : bool
|
| 973 |
+
If True, raise an error when the parser fails to convert a parameter.
|
| 974 |
+
use_default_template : bool
|
| 975 |
+
If True, initialize with default parameters before updating with those
|
| 976 |
+
in the given file. If False, the configuration class only contains the
|
| 977 |
+
parameters specified in the file. (Useful for updating dicts.)
|
| 978 |
+
"""
|
| 979 |
+
config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
|
| 980 |
+
|
| 981 |
+
if not use_default_template:
|
| 982 |
+
return config_from_file
|
| 983 |
+
|
| 984 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 985 |
+
config = RcParams({**rcParamsDefault, **config_from_file})
|
| 986 |
+
|
| 987 |
+
if "".join(config['text.latex.preamble']):
|
| 988 |
+
_log.info("""
|
| 989 |
+
*****************************************************************
|
| 990 |
+
You have the following UNSUPPORTED LaTeX preamble customizations:
|
| 991 |
+
%s
|
| 992 |
+
Please do not ask for support with these customizations active.
|
| 993 |
+
*****************************************************************
|
| 994 |
+
""", '\n'.join(config['text.latex.preamble']))
|
| 995 |
+
_log.debug('loaded rc file %s', fname)
|
| 996 |
+
|
| 997 |
+
return config
|
| 998 |
+
|
| 999 |
+
|
| 1000 |
+
rcParamsDefault = _rc_params_in_file(
|
| 1001 |
+
cbook._get_data_path("matplotlibrc"),
|
| 1002 |
+
# Strip leading comment.
|
| 1003 |
+
transform=lambda line: line[1:] if line.startswith("#") else line,
|
| 1004 |
+
fail_on_error=True)
|
| 1005 |
+
rcParamsDefault._update_raw(rcsetup._hardcoded_defaults)
|
| 1006 |
+
rcParamsDefault._ensure_has_backend()
|
| 1007 |
+
|
| 1008 |
+
rcParams = RcParams() # The global instance.
|
| 1009 |
+
rcParams._update_raw(rcParamsDefault)
|
| 1010 |
+
rcParams._update_raw(_rc_params_in_file(matplotlib_fname()))
|
| 1011 |
+
rcParamsOrig = rcParams.copy()
|
| 1012 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1013 |
+
# This also checks that all rcParams are indeed listed in the template.
|
| 1014 |
+
# Assigning to rcsetup.defaultParams is left only for backcompat.
|
| 1015 |
+
defaultParams = rcsetup.defaultParams = {
|
| 1016 |
+
# We want to resolve deprecated rcParams, but not backend...
|
| 1017 |
+
key: [(rcsetup._auto_backend_sentinel if key == "backend" else
|
| 1018 |
+
rcParamsDefault[key]),
|
| 1019 |
+
validator]
|
| 1020 |
+
for key, validator in rcsetup._validators.items()}
|
| 1021 |
+
if rcParams['axes.formatter.use_locale']:
|
| 1022 |
+
locale.setlocale(locale.LC_ALL, '')
|
| 1023 |
+
|
| 1024 |
+
|
| 1025 |
+
def rc(group, **kwargs):
|
| 1026 |
+
"""
|
| 1027 |
+
Set the current `.rcParams`. *group* is the grouping for the rc, e.g.,
|
| 1028 |
+
for ``lines.linewidth`` the group is ``lines``, for
|
| 1029 |
+
``axes.facecolor``, the group is ``axes``, and so on. Group may
|
| 1030 |
+
also be a list or tuple of group names, e.g., (*xtick*, *ytick*).
|
| 1031 |
+
*kwargs* is a dictionary attribute name/value pairs, e.g.,::
|
| 1032 |
+
|
| 1033 |
+
rc('lines', linewidth=2, color='r')
|
| 1034 |
+
|
| 1035 |
+
sets the current `.rcParams` and is equivalent to::
|
| 1036 |
+
|
| 1037 |
+
rcParams['lines.linewidth'] = 2
|
| 1038 |
+
rcParams['lines.color'] = 'r'
|
| 1039 |
+
|
| 1040 |
+
The following aliases are available to save typing for interactive users:
|
| 1041 |
+
|
| 1042 |
+
===== =================
|
| 1043 |
+
Alias Property
|
| 1044 |
+
===== =================
|
| 1045 |
+
'lw' 'linewidth'
|
| 1046 |
+
'ls' 'linestyle'
|
| 1047 |
+
'c' 'color'
|
| 1048 |
+
'fc' 'facecolor'
|
| 1049 |
+
'ec' 'edgecolor'
|
| 1050 |
+
'mew' 'markeredgewidth'
|
| 1051 |
+
'aa' 'antialiased'
|
| 1052 |
+
===== =================
|
| 1053 |
+
|
| 1054 |
+
Thus you could abbreviate the above call as::
|
| 1055 |
+
|
| 1056 |
+
rc('lines', lw=2, c='r')
|
| 1057 |
+
|
| 1058 |
+
Note you can use python's kwargs dictionary facility to store
|
| 1059 |
+
dictionaries of default parameters. e.g., you can customize the
|
| 1060 |
+
font rc as follows::
|
| 1061 |
+
|
| 1062 |
+
font = {'family' : 'monospace',
|
| 1063 |
+
'weight' : 'bold',
|
| 1064 |
+
'size' : 'larger'}
|
| 1065 |
+
rc('font', **font) # pass in the font dict as kwargs
|
| 1066 |
+
|
| 1067 |
+
This enables you to easily switch between several configurations. Use
|
| 1068 |
+
``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
|
| 1069 |
+
restore the default `.rcParams` after changes.
|
| 1070 |
+
|
| 1071 |
+
Notes
|
| 1072 |
+
-----
|
| 1073 |
+
Similar functionality is available by using the normal dict interface, i.e.
|
| 1074 |
+
``rcParams.update({"lines.linewidth": 2, ...})`` (but ``rcParams.update``
|
| 1075 |
+
does not support abbreviations or grouping).
|
| 1076 |
+
"""
|
| 1077 |
+
|
| 1078 |
+
aliases = {
|
| 1079 |
+
'lw': 'linewidth',
|
| 1080 |
+
'ls': 'linestyle',
|
| 1081 |
+
'c': 'color',
|
| 1082 |
+
'fc': 'facecolor',
|
| 1083 |
+
'ec': 'edgecolor',
|
| 1084 |
+
'mew': 'markeredgewidth',
|
| 1085 |
+
'aa': 'antialiased',
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
if isinstance(group, str):
|
| 1089 |
+
group = (group,)
|
| 1090 |
+
for g in group:
|
| 1091 |
+
for k, v in kwargs.items():
|
| 1092 |
+
name = aliases.get(k) or k
|
| 1093 |
+
key = f'{g}.{name}'
|
| 1094 |
+
try:
|
| 1095 |
+
rcParams[key] = v
|
| 1096 |
+
except KeyError as err:
|
| 1097 |
+
raise KeyError(('Unrecognized key "%s" for group "%s" and '
|
| 1098 |
+
'name "%s"') % (key, g, name)) from err
|
| 1099 |
+
|
| 1100 |
+
|
| 1101 |
+
def rcdefaults():
|
| 1102 |
+
"""
|
| 1103 |
+
Restore the `.rcParams` from Matplotlib's internal default style.
|
| 1104 |
+
|
| 1105 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1106 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1107 |
+
|
| 1108 |
+
See Also
|
| 1109 |
+
--------
|
| 1110 |
+
matplotlib.rc_file_defaults
|
| 1111 |
+
Restore the `.rcParams` from the rc file originally loaded by
|
| 1112 |
+
Matplotlib.
|
| 1113 |
+
matplotlib.style.use
|
| 1114 |
+
Use a specific style file. Call ``style.use('default')`` to restore
|
| 1115 |
+
the default style.
|
| 1116 |
+
"""
|
| 1117 |
+
# Deprecation warnings were already handled when creating rcParamsDefault,
|
| 1118 |
+
# no need to reemit them here.
|
| 1119 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1120 |
+
from .style.core import STYLE_BLACKLIST
|
| 1121 |
+
rcParams.clear()
|
| 1122 |
+
rcParams.update({k: v for k, v in rcParamsDefault.items()
|
| 1123 |
+
if k not in STYLE_BLACKLIST})
|
| 1124 |
+
|
| 1125 |
+
|
| 1126 |
+
def rc_file_defaults():
|
| 1127 |
+
"""
|
| 1128 |
+
Restore the `.rcParams` from the original rc file loaded by Matplotlib.
|
| 1129 |
+
|
| 1130 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1131 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1132 |
+
"""
|
| 1133 |
+
# Deprecation warnings were already handled when creating rcParamsOrig, no
|
| 1134 |
+
# need to reemit them here.
|
| 1135 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1136 |
+
from .style.core import STYLE_BLACKLIST
|
| 1137 |
+
rcParams.update({k: rcParamsOrig[k] for k in rcParamsOrig
|
| 1138 |
+
if k not in STYLE_BLACKLIST})
|
| 1139 |
+
|
| 1140 |
+
|
| 1141 |
+
def rc_file(fname, *, use_default_template=True):
|
| 1142 |
+
"""
|
| 1143 |
+
Update `.rcParams` from file.
|
| 1144 |
+
|
| 1145 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1146 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1147 |
+
|
| 1148 |
+
Parameters
|
| 1149 |
+
----------
|
| 1150 |
+
fname : str or path-like
|
| 1151 |
+
A file with Matplotlib rc settings.
|
| 1152 |
+
|
| 1153 |
+
use_default_template : bool
|
| 1154 |
+
If True, initialize with default parameters before updating with those
|
| 1155 |
+
in the given file. If False, the current configuration persists
|
| 1156 |
+
and only the parameters specified in the file are updated.
|
| 1157 |
+
"""
|
| 1158 |
+
# Deprecation warnings were already handled in rc_params_from_file, no need
|
| 1159 |
+
# to reemit them here.
|
| 1160 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1161 |
+
from .style.core import STYLE_BLACKLIST
|
| 1162 |
+
rc_from_file = rc_params_from_file(
|
| 1163 |
+
fname, use_default_template=use_default_template)
|
| 1164 |
+
rcParams.update({k: rc_from_file[k] for k in rc_from_file
|
| 1165 |
+
if k not in STYLE_BLACKLIST})
|
| 1166 |
+
|
| 1167 |
+
|
| 1168 |
+
@contextlib.contextmanager
|
| 1169 |
+
def rc_context(rc=None, fname=None):
|
| 1170 |
+
"""
|
| 1171 |
+
Return a context manager for temporarily changing rcParams.
|
| 1172 |
+
|
| 1173 |
+
The :rc:`backend` will not be reset by the context manager.
|
| 1174 |
+
|
| 1175 |
+
rcParams changed both through the context manager invocation and
|
| 1176 |
+
in the body of the context will be reset on context exit.
|
| 1177 |
+
|
| 1178 |
+
Parameters
|
| 1179 |
+
----------
|
| 1180 |
+
rc : dict
|
| 1181 |
+
The rcParams to temporarily set.
|
| 1182 |
+
fname : str or path-like
|
| 1183 |
+
A file with Matplotlib rc settings. If both *fname* and *rc* are given,
|
| 1184 |
+
settings from *rc* take precedence.
|
| 1185 |
+
|
| 1186 |
+
See Also
|
| 1187 |
+
--------
|
| 1188 |
+
:ref:`customizing-with-matplotlibrc-files`
|
| 1189 |
+
|
| 1190 |
+
Examples
|
| 1191 |
+
--------
|
| 1192 |
+
Passing explicit values via a dict::
|
| 1193 |
+
|
| 1194 |
+
with mpl.rc_context({'interactive': False}):
|
| 1195 |
+
fig, ax = plt.subplots()
|
| 1196 |
+
ax.plot(range(3), range(3))
|
| 1197 |
+
fig.savefig('example.png')
|
| 1198 |
+
plt.close(fig)
|
| 1199 |
+
|
| 1200 |
+
Loading settings from a file::
|
| 1201 |
+
|
| 1202 |
+
with mpl.rc_context(fname='print.rc'):
|
| 1203 |
+
plt.plot(x, y) # uses 'print.rc'
|
| 1204 |
+
|
| 1205 |
+
Setting in the context body::
|
| 1206 |
+
|
| 1207 |
+
with mpl.rc_context():
|
| 1208 |
+
# will be reset
|
| 1209 |
+
mpl.rcParams['lines.linewidth'] = 5
|
| 1210 |
+
plt.plot(x, y)
|
| 1211 |
+
|
| 1212 |
+
"""
|
| 1213 |
+
orig = dict(rcParams.copy())
|
| 1214 |
+
del orig['backend']
|
| 1215 |
+
try:
|
| 1216 |
+
if fname:
|
| 1217 |
+
rc_file(fname)
|
| 1218 |
+
if rc:
|
| 1219 |
+
rcParams.update(rc)
|
| 1220 |
+
yield
|
| 1221 |
+
finally:
|
| 1222 |
+
rcParams._update_raw(orig) # Revert to the original rcs.
|
| 1223 |
+
|
| 1224 |
+
|
| 1225 |
+
def use(backend, *, force=True):
|
| 1226 |
+
"""
|
| 1227 |
+
Select the backend used for rendering and GUI integration.
|
| 1228 |
+
|
| 1229 |
+
If pyplot is already imported, `~matplotlib.pyplot.switch_backend` is used
|
| 1230 |
+
and if the new backend is different than the current backend, all Figures
|
| 1231 |
+
will be closed.
|
| 1232 |
+
|
| 1233 |
+
Parameters
|
| 1234 |
+
----------
|
| 1235 |
+
backend : str
|
| 1236 |
+
The backend to switch to. This can either be one of the standard
|
| 1237 |
+
backend names, which are case-insensitive:
|
| 1238 |
+
|
| 1239 |
+
- interactive backends:
|
| 1240 |
+
GTK3Agg, GTK3Cairo, GTK4Agg, GTK4Cairo, MacOSX, nbAgg, notebook, QtAgg,
|
| 1241 |
+
QtCairo, TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo, Qt5Agg, Qt5Cairo
|
| 1242 |
+
|
| 1243 |
+
- non-interactive backends:
|
| 1244 |
+
agg, cairo, pdf, pgf, ps, svg, template
|
| 1245 |
+
|
| 1246 |
+
or a string of the form: ``module://my.module.name``.
|
| 1247 |
+
|
| 1248 |
+
notebook is a synonym for nbAgg.
|
| 1249 |
+
|
| 1250 |
+
Switching to an interactive backend is not possible if an unrelated
|
| 1251 |
+
event loop has already been started (e.g., switching to GTK3Agg if a
|
| 1252 |
+
TkAgg window has already been opened). Switching to a non-interactive
|
| 1253 |
+
backend is always possible.
|
| 1254 |
+
|
| 1255 |
+
force : bool, default: True
|
| 1256 |
+
If True (the default), raise an `ImportError` if the backend cannot be
|
| 1257 |
+
set up (either because it fails to import, or because an incompatible
|
| 1258 |
+
GUI interactive framework is already running); if False, silently
|
| 1259 |
+
ignore the failure.
|
| 1260 |
+
|
| 1261 |
+
See Also
|
| 1262 |
+
--------
|
| 1263 |
+
:ref:`backends`
|
| 1264 |
+
matplotlib.get_backend
|
| 1265 |
+
matplotlib.pyplot.switch_backend
|
| 1266 |
+
|
| 1267 |
+
"""
|
| 1268 |
+
name = rcsetup.validate_backend(backend)
|
| 1269 |
+
# don't (prematurely) resolve the "auto" backend setting
|
| 1270 |
+
if rcParams._get_backend_or_none() == name:
|
| 1271 |
+
# Nothing to do if the requested backend is already set
|
| 1272 |
+
pass
|
| 1273 |
+
else:
|
| 1274 |
+
# if pyplot is not already imported, do not import it. Doing
|
| 1275 |
+
# so may trigger a `plt.switch_backend` to the _default_ backend
|
| 1276 |
+
# before we get a chance to change to the one the user just requested
|
| 1277 |
+
plt = sys.modules.get('matplotlib.pyplot')
|
| 1278 |
+
# if pyplot is imported, then try to change backends
|
| 1279 |
+
if plt is not None:
|
| 1280 |
+
try:
|
| 1281 |
+
# we need this import check here to re-raise if the
|
| 1282 |
+
# user does not have the libraries to support their
|
| 1283 |
+
# chosen backend installed.
|
| 1284 |
+
plt.switch_backend(name)
|
| 1285 |
+
except ImportError:
|
| 1286 |
+
if force:
|
| 1287 |
+
raise
|
| 1288 |
+
# if we have not imported pyplot, then we can set the rcParam
|
| 1289 |
+
# value which will be respected when the user finally imports
|
| 1290 |
+
# pyplot
|
| 1291 |
+
else:
|
| 1292 |
+
rcParams['backend'] = backend
|
| 1293 |
+
# if the user has asked for a given backend, do not helpfully
|
| 1294 |
+
# fallback
|
| 1295 |
+
rcParams['backend_fallback'] = False
|
| 1296 |
+
|
| 1297 |
+
|
| 1298 |
+
if os.environ.get('MPLBACKEND'):
|
| 1299 |
+
rcParams['backend'] = os.environ.get('MPLBACKEND')
|
| 1300 |
+
|
| 1301 |
+
|
| 1302 |
+
def get_backend(*, auto_select=True):
|
| 1303 |
+
"""
|
| 1304 |
+
Return the name of the current backend.
|
| 1305 |
+
|
| 1306 |
+
Parameters
|
| 1307 |
+
----------
|
| 1308 |
+
auto_select : bool, default: True
|
| 1309 |
+
Whether to trigger backend resolution if no backend has been
|
| 1310 |
+
selected so far. If True, this ensures that a valid backend
|
| 1311 |
+
is returned. If False, this returns None if no backend has been
|
| 1312 |
+
selected so far.
|
| 1313 |
+
|
| 1314 |
+
.. versionadded:: 3.10
|
| 1315 |
+
|
| 1316 |
+
.. admonition:: Provisional
|
| 1317 |
+
|
| 1318 |
+
The *auto_select* flag is provisional. It may be changed or removed
|
| 1319 |
+
without prior warning.
|
| 1320 |
+
|
| 1321 |
+
See Also
|
| 1322 |
+
--------
|
| 1323 |
+
matplotlib.use
|
| 1324 |
+
"""
|
| 1325 |
+
if auto_select:
|
| 1326 |
+
return rcParams['backend']
|
| 1327 |
+
else:
|
| 1328 |
+
backend = rcParams._get('backend')
|
| 1329 |
+
if backend is rcsetup._auto_backend_sentinel:
|
| 1330 |
+
return None
|
| 1331 |
+
else:
|
| 1332 |
+
return backend
|
| 1333 |
+
|
| 1334 |
+
|
| 1335 |
+
def interactive(b):
|
| 1336 |
+
"""
|
| 1337 |
+
Set whether to redraw after every plotting command (e.g. `.pyplot.xlabel`).
|
| 1338 |
+
"""
|
| 1339 |
+
rcParams['interactive'] = b
|
| 1340 |
+
|
| 1341 |
+
|
| 1342 |
+
def is_interactive():
|
| 1343 |
+
"""
|
| 1344 |
+
Return whether to redraw after every plotting command.
|
| 1345 |
+
|
| 1346 |
+
.. note::
|
| 1347 |
+
|
| 1348 |
+
This function is only intended for use in backends. End users should
|
| 1349 |
+
use `.pyplot.isinteractive` instead.
|
| 1350 |
+
"""
|
| 1351 |
+
return rcParams['interactive']
|
| 1352 |
+
|
| 1353 |
+
|
| 1354 |
+
def _val_or_rc(val, rc_name):
|
| 1355 |
+
"""
|
| 1356 |
+
If *val* is None, return ``mpl.rcParams[rc_name]``, otherwise return val.
|
| 1357 |
+
"""
|
| 1358 |
+
return val if val is not None else rcParams[rc_name]
|
| 1359 |
+
|
| 1360 |
+
|
| 1361 |
+
def _init_tests():
|
| 1362 |
+
# The version of FreeType to install locally for running the tests. This must match
|
| 1363 |
+
# the value in `meson.build`.
|
| 1364 |
+
LOCAL_FREETYPE_VERSION = '2.6.1'
|
| 1365 |
+
|
| 1366 |
+
from matplotlib import ft2font
|
| 1367 |
+
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
|
| 1368 |
+
ft2font.__freetype_build_type__ != 'local'):
|
| 1369 |
+
_log.warning(
|
| 1370 |
+
"Matplotlib is not built with the correct FreeType version to run tests. "
|
| 1371 |
+
"Rebuild without setting system-freetype=true in Meson setup options. "
|
| 1372 |
+
"Expect many image comparison failures below. "
|
| 1373 |
+
"Expected freetype version %s. "
|
| 1374 |
+
"Found freetype version %s. "
|
| 1375 |
+
"Freetype build type is %slocal.",
|
| 1376 |
+
LOCAL_FREETYPE_VERSION,
|
| 1377 |
+
ft2font.__freetype_version__,
|
| 1378 |
+
"" if ft2font.__freetype_build_type__ == 'local' else "not ")
|
| 1379 |
+
|
| 1380 |
+
|
| 1381 |
+
def _replacer(data, value):
|
| 1382 |
+
"""
|
| 1383 |
+
Either returns ``data[value]`` or passes ``data`` back, converts either to
|
| 1384 |
+
a sequence.
|
| 1385 |
+
"""
|
| 1386 |
+
try:
|
| 1387 |
+
# if key isn't a string don't bother
|
| 1388 |
+
if isinstance(value, str):
|
| 1389 |
+
# try to use __getitem__
|
| 1390 |
+
value = data[value]
|
| 1391 |
+
except Exception:
|
| 1392 |
+
# key does not exist, silently fall back to key
|
| 1393 |
+
pass
|
| 1394 |
+
return cbook.sanitize_sequence(value)
|
| 1395 |
+
|
| 1396 |
+
|
| 1397 |
+
def _label_from_arg(y, default_name):
|
| 1398 |
+
try:
|
| 1399 |
+
return y.name
|
| 1400 |
+
except AttributeError:
|
| 1401 |
+
if isinstance(default_name, str):
|
| 1402 |
+
return default_name
|
| 1403 |
+
return None
|
| 1404 |
+
|
| 1405 |
+
|
| 1406 |
+
def _add_data_doc(docstring, replace_names):
|
| 1407 |
+
"""
|
| 1408 |
+
Add documentation for a *data* field to the given docstring.
|
| 1409 |
+
|
| 1410 |
+
Parameters
|
| 1411 |
+
----------
|
| 1412 |
+
docstring : str
|
| 1413 |
+
The input docstring.
|
| 1414 |
+
replace_names : list of str or None
|
| 1415 |
+
The list of parameter names which arguments should be replaced by
|
| 1416 |
+
``data[name]`` (if ``data[name]`` does not throw an exception). If
|
| 1417 |
+
None, replacement is attempted for all arguments.
|
| 1418 |
+
|
| 1419 |
+
Returns
|
| 1420 |
+
-------
|
| 1421 |
+
str
|
| 1422 |
+
The augmented docstring.
|
| 1423 |
+
"""
|
| 1424 |
+
if (docstring is None
|
| 1425 |
+
or replace_names is not None and len(replace_names) == 0):
|
| 1426 |
+
return docstring
|
| 1427 |
+
docstring = inspect.cleandoc(docstring)
|
| 1428 |
+
|
| 1429 |
+
data_doc = ("""\
|
| 1430 |
+
If given, all parameters also accept a string ``s``, which is
|
| 1431 |
+
interpreted as ``data[s]`` if ``s`` is a key in ``data``."""
|
| 1432 |
+
if replace_names is None else f"""\
|
| 1433 |
+
If given, the following parameters also accept a string ``s``, which is
|
| 1434 |
+
interpreted as ``data[s]`` if ``s`` is a key in ``data``:
|
| 1435 |
+
|
| 1436 |
+
{', '.join(map('*{}*'.format, replace_names))}""")
|
| 1437 |
+
# using string replacement instead of formatting has the advantages
|
| 1438 |
+
# 1) simpler indent handling
|
| 1439 |
+
# 2) prevent problems with formatting characters '{', '%' in the docstring
|
| 1440 |
+
if _log.level <= logging.DEBUG:
|
| 1441 |
+
# test_data_parameter_replacement() tests against these log messages
|
| 1442 |
+
# make sure to keep message and test in sync
|
| 1443 |
+
if "data : indexable object, optional" not in docstring:
|
| 1444 |
+
_log.debug("data parameter docstring error: no data parameter")
|
| 1445 |
+
if 'DATA_PARAMETER_PLACEHOLDER' not in docstring:
|
| 1446 |
+
_log.debug("data parameter docstring error: missing placeholder")
|
| 1447 |
+
return docstring.replace(' DATA_PARAMETER_PLACEHOLDER', data_doc)
|
| 1448 |
+
|
| 1449 |
+
|
| 1450 |
+
def _preprocess_data(func=None, *, replace_names=None, label_namer=None):
|
| 1451 |
+
"""
|
| 1452 |
+
A decorator to add a 'data' kwarg to a function.
|
| 1453 |
+
|
| 1454 |
+
When applied::
|
| 1455 |
+
|
| 1456 |
+
@_preprocess_data()
|
| 1457 |
+
def func(ax, *args, **kwargs): ...
|
| 1458 |
+
|
| 1459 |
+
the signature is modified to ``decorated(ax, *args, data=None, **kwargs)``
|
| 1460 |
+
with the following behavior:
|
| 1461 |
+
|
| 1462 |
+
- if called with ``data=None``, forward the other arguments to ``func``;
|
| 1463 |
+
- otherwise, *data* must be a mapping; for any argument passed in as a
|
| 1464 |
+
string ``name``, replace the argument by ``data[name]`` (if this does not
|
| 1465 |
+
throw an exception), then forward the arguments to ``func``.
|
| 1466 |
+
|
| 1467 |
+
In either case, any argument that is a `MappingView` is also converted to a
|
| 1468 |
+
list.
|
| 1469 |
+
|
| 1470 |
+
Parameters
|
| 1471 |
+
----------
|
| 1472 |
+
replace_names : list of str or None, default: None
|
| 1473 |
+
The list of parameter names for which lookup into *data* should be
|
| 1474 |
+
attempted. If None, replacement is attempted for all arguments.
|
| 1475 |
+
label_namer : str, default: None
|
| 1476 |
+
If set e.g. to "namer" (which must be a kwarg in the function's
|
| 1477 |
+
signature -- not as ``**kwargs``), if the *namer* argument passed in is
|
| 1478 |
+
a (string) key of *data* and no *label* kwarg is passed, then use the
|
| 1479 |
+
(string) value of the *namer* as *label*. ::
|
| 1480 |
+
|
| 1481 |
+
@_preprocess_data(label_namer="foo")
|
| 1482 |
+
def func(foo, label=None): ...
|
| 1483 |
+
|
| 1484 |
+
func("key", data={"key": value})
|
| 1485 |
+
# is equivalent to
|
| 1486 |
+
func.__wrapped__(value, label="key")
|
| 1487 |
+
"""
|
| 1488 |
+
|
| 1489 |
+
if func is None: # Return the actual decorator.
|
| 1490 |
+
return functools.partial(
|
| 1491 |
+
_preprocess_data,
|
| 1492 |
+
replace_names=replace_names, label_namer=label_namer)
|
| 1493 |
+
|
| 1494 |
+
sig = inspect.signature(func)
|
| 1495 |
+
varargs_name = None
|
| 1496 |
+
varkwargs_name = None
|
| 1497 |
+
arg_names = []
|
| 1498 |
+
params = list(sig.parameters.values())
|
| 1499 |
+
for p in params:
|
| 1500 |
+
if p.kind is Parameter.VAR_POSITIONAL:
|
| 1501 |
+
varargs_name = p.name
|
| 1502 |
+
elif p.kind is Parameter.VAR_KEYWORD:
|
| 1503 |
+
varkwargs_name = p.name
|
| 1504 |
+
else:
|
| 1505 |
+
arg_names.append(p.name)
|
| 1506 |
+
data_param = Parameter("data", Parameter.KEYWORD_ONLY, default=None)
|
| 1507 |
+
if varkwargs_name:
|
| 1508 |
+
params.insert(-1, data_param)
|
| 1509 |
+
else:
|
| 1510 |
+
params.append(data_param)
|
| 1511 |
+
new_sig = sig.replace(parameters=params)
|
| 1512 |
+
arg_names = arg_names[1:] # remove the first "ax" / self arg
|
| 1513 |
+
|
| 1514 |
+
assert {*arg_names}.issuperset(replace_names or []) or varkwargs_name, (
|
| 1515 |
+
"Matplotlib internal error: invalid replace_names "
|
| 1516 |
+
f"({replace_names!r}) for {func.__name__!r}")
|
| 1517 |
+
assert label_namer is None or label_namer in arg_names, (
|
| 1518 |
+
"Matplotlib internal error: invalid label_namer "
|
| 1519 |
+
f"({label_namer!r}) for {func.__name__!r}")
|
| 1520 |
+
|
| 1521 |
+
@functools.wraps(func)
|
| 1522 |
+
def inner(ax, *args, data=None, **kwargs):
|
| 1523 |
+
if data is None:
|
| 1524 |
+
return func(
|
| 1525 |
+
ax,
|
| 1526 |
+
*map(cbook.sanitize_sequence, args),
|
| 1527 |
+
**{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()})
|
| 1528 |
+
|
| 1529 |
+
bound = new_sig.bind(ax, *args, **kwargs)
|
| 1530 |
+
auto_label = (bound.arguments.get(label_namer)
|
| 1531 |
+
or bound.kwargs.get(label_namer))
|
| 1532 |
+
|
| 1533 |
+
for k, v in bound.arguments.items():
|
| 1534 |
+
if k == varkwargs_name:
|
| 1535 |
+
for k1, v1 in v.items():
|
| 1536 |
+
if replace_names is None or k1 in replace_names:
|
| 1537 |
+
v[k1] = _replacer(data, v1)
|
| 1538 |
+
elif k == varargs_name:
|
| 1539 |
+
if replace_names is None:
|
| 1540 |
+
bound.arguments[k] = tuple(_replacer(data, v1) for v1 in v)
|
| 1541 |
+
else:
|
| 1542 |
+
if replace_names is None or k in replace_names:
|
| 1543 |
+
bound.arguments[k] = _replacer(data, v)
|
| 1544 |
+
|
| 1545 |
+
new_args = bound.args
|
| 1546 |
+
new_kwargs = bound.kwargs
|
| 1547 |
+
|
| 1548 |
+
args_and_kwargs = {**bound.arguments, **bound.kwargs}
|
| 1549 |
+
if label_namer and "label" not in args_and_kwargs:
|
| 1550 |
+
new_kwargs["label"] = _label_from_arg(
|
| 1551 |
+
args_and_kwargs.get(label_namer), auto_label)
|
| 1552 |
+
|
| 1553 |
+
return func(*new_args, **new_kwargs)
|
| 1554 |
+
|
| 1555 |
+
inner.__doc__ = _add_data_doc(inner.__doc__, replace_names)
|
| 1556 |
+
inner.__signature__ = new_sig
|
| 1557 |
+
return inner
|
| 1558 |
+
|
| 1559 |
+
|
| 1560 |
+
_log.debug('interactive is %s', is_interactive())
|
| 1561 |
+
_log.debug('platform is %s', sys.platform)
|
| 1562 |
+
|
| 1563 |
+
|
| 1564 |
+
@_api.deprecated("3.10", alternative="matplotlib.cbook.sanitize_sequence")
|
| 1565 |
+
def sanitize_sequence(data):
|
| 1566 |
+
return cbook.sanitize_sequence(data)
|
| 1567 |
+
|
| 1568 |
+
|
| 1569 |
+
@_api.deprecated("3.10", alternative="matplotlib.rcsetup.validate_backend")
|
| 1570 |
+
def validate_backend(s):
|
| 1571 |
+
return rcsetup.validate_backend(s)
|
| 1572 |
+
|
| 1573 |
+
|
| 1574 |
+
# workaround: we must defer colormaps import to after loading rcParams, because
|
| 1575 |
+
# colormap creation depends on rcParams
|
| 1576 |
+
from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
| 1577 |
+
from matplotlib.cm import _multivar_colormaps as multivar_colormaps # noqa: E402
|
| 1578 |
+
from matplotlib.cm import _bivar_colormaps as bivar_colormaps # noqa: E402
|
| 1579 |
+
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.pyi
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = [
|
| 2 |
+
"__bibtex__",
|
| 3 |
+
"__version__",
|
| 4 |
+
"__version_info__",
|
| 5 |
+
"set_loglevel",
|
| 6 |
+
"ExecutableNotFoundError",
|
| 7 |
+
"get_configdir",
|
| 8 |
+
"get_cachedir",
|
| 9 |
+
"get_data_path",
|
| 10 |
+
"matplotlib_fname",
|
| 11 |
+
"MatplotlibDeprecationWarning",
|
| 12 |
+
"RcParams",
|
| 13 |
+
"rc_params",
|
| 14 |
+
"rc_params_from_file",
|
| 15 |
+
"rcParamsDefault",
|
| 16 |
+
"rcParams",
|
| 17 |
+
"rcParamsOrig",
|
| 18 |
+
"defaultParams",
|
| 19 |
+
"rc",
|
| 20 |
+
"rcdefaults",
|
| 21 |
+
"rc_file_defaults",
|
| 22 |
+
"rc_file",
|
| 23 |
+
"rc_context",
|
| 24 |
+
"use",
|
| 25 |
+
"get_backend",
|
| 26 |
+
"interactive",
|
| 27 |
+
"is_interactive",
|
| 28 |
+
"colormaps",
|
| 29 |
+
"color_sequences",
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
import os
|
| 33 |
+
from pathlib import Path
|
| 34 |
+
|
| 35 |
+
from collections.abc import Callable, Generator
|
| 36 |
+
import contextlib
|
| 37 |
+
from packaging.version import Version
|
| 38 |
+
|
| 39 |
+
from matplotlib._api import MatplotlibDeprecationWarning
|
| 40 |
+
from typing import Any, Literal, NamedTuple, overload
|
| 41 |
+
|
| 42 |
+
class _VersionInfo(NamedTuple):
|
| 43 |
+
major: int
|
| 44 |
+
minor: int
|
| 45 |
+
micro: int
|
| 46 |
+
releaselevel: str
|
| 47 |
+
serial: int
|
| 48 |
+
|
| 49 |
+
__bibtex__: str
|
| 50 |
+
__version__: str
|
| 51 |
+
__version_info__: _VersionInfo
|
| 52 |
+
|
| 53 |
+
def set_loglevel(level: str) -> None: ...
|
| 54 |
+
|
| 55 |
+
class _ExecInfo(NamedTuple):
|
| 56 |
+
executable: str
|
| 57 |
+
raw_version: str
|
| 58 |
+
version: Version
|
| 59 |
+
|
| 60 |
+
class ExecutableNotFoundError(FileNotFoundError): ...
|
| 61 |
+
|
| 62 |
+
def _get_executable_info(name: str) -> _ExecInfo: ...
|
| 63 |
+
def get_configdir() -> str: ...
|
| 64 |
+
def get_cachedir() -> str: ...
|
| 65 |
+
def get_data_path() -> str: ...
|
| 66 |
+
def matplotlib_fname() -> str: ...
|
| 67 |
+
|
| 68 |
+
class RcParams(dict[str, Any]):
|
| 69 |
+
validate: dict[str, Callable]
|
| 70 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 71 |
+
def _set(self, key: str, val: Any) -> None: ...
|
| 72 |
+
def _get(self, key: str) -> Any: ...
|
| 73 |
+
|
| 74 |
+
def _update_raw(self, other_params: dict | RcParams) -> None: ...
|
| 75 |
+
|
| 76 |
+
def _ensure_has_backend(self) -> None: ...
|
| 77 |
+
def __setitem__(self, key: str, val: Any) -> None: ...
|
| 78 |
+
def __getitem__(self, key: str) -> Any: ...
|
| 79 |
+
def __iter__(self) -> Generator[str, None, None]: ...
|
| 80 |
+
def __len__(self) -> int: ...
|
| 81 |
+
def find_all(self, pattern: str) -> RcParams: ...
|
| 82 |
+
def copy(self) -> RcParams: ...
|
| 83 |
+
|
| 84 |
+
def rc_params(fail_on_error: bool = ...) -> RcParams: ...
|
| 85 |
+
def rc_params_from_file(
|
| 86 |
+
fname: str | Path | os.PathLike,
|
| 87 |
+
fail_on_error: bool = ...,
|
| 88 |
+
use_default_template: bool = ...,
|
| 89 |
+
) -> RcParams: ...
|
| 90 |
+
|
| 91 |
+
rcParamsDefault: RcParams
|
| 92 |
+
rcParams: RcParams
|
| 93 |
+
rcParamsOrig: RcParams
|
| 94 |
+
defaultParams: dict[str, Any]
|
| 95 |
+
|
| 96 |
+
def rc(group: str, **kwargs) -> None: ...
|
| 97 |
+
def rcdefaults() -> None: ...
|
| 98 |
+
def rc_file_defaults() -> None: ...
|
| 99 |
+
def rc_file(
|
| 100 |
+
fname: str | Path | os.PathLike, *, use_default_template: bool = ...
|
| 101 |
+
) -> None: ...
|
| 102 |
+
@contextlib.contextmanager
|
| 103 |
+
def rc_context(
|
| 104 |
+
rc: dict[str, Any] | None = ..., fname: str | Path | os.PathLike | None = ...
|
| 105 |
+
) -> Generator[None, None, None]: ...
|
| 106 |
+
def use(backend: str, *, force: bool = ...) -> None: ...
|
| 107 |
+
@overload
|
| 108 |
+
def get_backend(*, auto_select: Literal[True] = True) -> str: ...
|
| 109 |
+
@overload
|
| 110 |
+
def get_backend(*, auto_select: Literal[False]) -> str | None: ...
|
| 111 |
+
def interactive(b: bool) -> None: ...
|
| 112 |
+
def is_interactive() -> bool: ...
|
| 113 |
+
|
| 114 |
+
def _preprocess_data(
|
| 115 |
+
func: Callable | None = ...,
|
| 116 |
+
*,
|
| 117 |
+
replace_names: list[str] | None = ...,
|
| 118 |
+
label_namer: str | None = ...
|
| 119 |
+
) -> Callable: ...
|
| 120 |
+
|
| 121 |
+
from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
| 122 |
+
from matplotlib.cm import _multivar_colormaps as multivar_colormaps # noqa: E402
|
| 123 |
+
from matplotlib.cm import _bivar_colormaps as bivar_colormaps # noqa: E402
|
| 124 |
+
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_afm.py
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A python interface to Adobe Font Metrics Files.
|
| 3 |
+
|
| 4 |
+
Although a number of other Python implementations exist, and may be more
|
| 5 |
+
complete than this, it was decided not to go with them because they were
|
| 6 |
+
either:
|
| 7 |
+
|
| 8 |
+
1) copyrighted or used a non-BSD compatible license
|
| 9 |
+
2) had too many dependencies and a free standing lib was needed
|
| 10 |
+
3) did more than needed and it was easier to write afresh rather than
|
| 11 |
+
figure out how to get just what was needed.
|
| 12 |
+
|
| 13 |
+
It is pretty easy to use, and has no external dependencies:
|
| 14 |
+
|
| 15 |
+
>>> import matplotlib as mpl
|
| 16 |
+
>>> from pathlib import Path
|
| 17 |
+
>>> afm_path = Path(mpl.get_data_path(), 'fonts', 'afm', 'ptmr8a.afm')
|
| 18 |
+
>>>
|
| 19 |
+
>>> from matplotlib.afm import AFM
|
| 20 |
+
>>> with afm_path.open('rb') as fh:
|
| 21 |
+
... afm = AFM(fh)
|
| 22 |
+
>>> afm.string_width_height('What the heck?')
|
| 23 |
+
(6220.0, 694)
|
| 24 |
+
>>> afm.get_fontname()
|
| 25 |
+
'Times-Roman'
|
| 26 |
+
>>> afm.get_kern_dist('A', 'f')
|
| 27 |
+
0
|
| 28 |
+
>>> afm.get_kern_dist('A', 'y')
|
| 29 |
+
-92.0
|
| 30 |
+
>>> afm.get_bbox_char('!')
|
| 31 |
+
[130, -9, 238, 676]
|
| 32 |
+
|
| 33 |
+
As in the Adobe Font Metrics File Format Specification, all dimensions
|
| 34 |
+
are given in units of 1/1000 of the scale factor (point size) of the font
|
| 35 |
+
being used.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
from collections import namedtuple
|
| 39 |
+
import logging
|
| 40 |
+
import re
|
| 41 |
+
|
| 42 |
+
from ._mathtext_data import uni2type1
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
_log = logging.getLogger(__name__)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _to_int(x):
|
| 49 |
+
# Some AFM files have floats where we are expecting ints -- there is
|
| 50 |
+
# probably a better way to handle this (support floats, round rather than
|
| 51 |
+
# truncate). But I don't know what the best approach is now and this
|
| 52 |
+
# change to _to_int should at least prevent Matplotlib from crashing on
|
| 53 |
+
# these. JDH (2009-11-06)
|
| 54 |
+
return int(float(x))
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _to_float(x):
|
| 58 |
+
# Some AFM files use "," instead of "." as decimal separator -- this
|
| 59 |
+
# shouldn't be ambiguous (unless someone is wicked enough to use "," as
|
| 60 |
+
# thousands separator...).
|
| 61 |
+
if isinstance(x, bytes):
|
| 62 |
+
# Encoding doesn't really matter -- if we have codepoints >127 the call
|
| 63 |
+
# to float() will error anyways.
|
| 64 |
+
x = x.decode('latin-1')
|
| 65 |
+
return float(x.replace(',', '.'))
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def _to_str(x):
|
| 69 |
+
return x.decode('utf8')
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def _to_list_of_ints(s):
|
| 73 |
+
s = s.replace(b',', b' ')
|
| 74 |
+
return [_to_int(val) for val in s.split()]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def _to_list_of_floats(s):
|
| 78 |
+
return [_to_float(val) for val in s.split()]
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def _to_bool(s):
|
| 82 |
+
if s.lower().strip() in (b'false', b'0', b'no'):
|
| 83 |
+
return False
|
| 84 |
+
else:
|
| 85 |
+
return True
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def _parse_header(fh):
|
| 89 |
+
"""
|
| 90 |
+
Read the font metrics header (up to the char metrics) and returns
|
| 91 |
+
a dictionary mapping *key* to *val*. *val* will be converted to the
|
| 92 |
+
appropriate python type as necessary; e.g.:
|
| 93 |
+
|
| 94 |
+
* 'False'->False
|
| 95 |
+
* '0'->0
|
| 96 |
+
* '-168 -218 1000 898'-> [-168, -218, 1000, 898]
|
| 97 |
+
|
| 98 |
+
Dictionary keys are
|
| 99 |
+
|
| 100 |
+
StartFontMetrics, FontName, FullName, FamilyName, Weight,
|
| 101 |
+
ItalicAngle, IsFixedPitch, FontBBox, UnderlinePosition,
|
| 102 |
+
UnderlineThickness, Version, Notice, EncodingScheme, CapHeight,
|
| 103 |
+
XHeight, Ascender, Descender, StartCharMetrics
|
| 104 |
+
"""
|
| 105 |
+
header_converters = {
|
| 106 |
+
b'StartFontMetrics': _to_float,
|
| 107 |
+
b'FontName': _to_str,
|
| 108 |
+
b'FullName': _to_str,
|
| 109 |
+
b'FamilyName': _to_str,
|
| 110 |
+
b'Weight': _to_str,
|
| 111 |
+
b'ItalicAngle': _to_float,
|
| 112 |
+
b'IsFixedPitch': _to_bool,
|
| 113 |
+
b'FontBBox': _to_list_of_ints,
|
| 114 |
+
b'UnderlinePosition': _to_float,
|
| 115 |
+
b'UnderlineThickness': _to_float,
|
| 116 |
+
b'Version': _to_str,
|
| 117 |
+
# Some AFM files have non-ASCII characters (which are not allowed by
|
| 118 |
+
# the spec). Given that there is actually no public API to even access
|
| 119 |
+
# this field, just return it as straight bytes.
|
| 120 |
+
b'Notice': lambda x: x,
|
| 121 |
+
b'EncodingScheme': _to_str,
|
| 122 |
+
b'CapHeight': _to_float, # Is the second version a mistake, or
|
| 123 |
+
b'Capheight': _to_float, # do some AFM files contain 'Capheight'? -JKS
|
| 124 |
+
b'XHeight': _to_float,
|
| 125 |
+
b'Ascender': _to_float,
|
| 126 |
+
b'Descender': _to_float,
|
| 127 |
+
b'StdHW': _to_float,
|
| 128 |
+
b'StdVW': _to_float,
|
| 129 |
+
b'StartCharMetrics': _to_int,
|
| 130 |
+
b'CharacterSet': _to_str,
|
| 131 |
+
b'Characters': _to_int,
|
| 132 |
+
}
|
| 133 |
+
d = {}
|
| 134 |
+
first_line = True
|
| 135 |
+
for line in fh:
|
| 136 |
+
line = line.rstrip()
|
| 137 |
+
if line.startswith(b'Comment'):
|
| 138 |
+
continue
|
| 139 |
+
lst = line.split(b' ', 1)
|
| 140 |
+
key = lst[0]
|
| 141 |
+
if first_line:
|
| 142 |
+
# AFM spec, Section 4: The StartFontMetrics keyword
|
| 143 |
+
# [followed by a version number] must be the first line in
|
| 144 |
+
# the file, and the EndFontMetrics keyword must be the
|
| 145 |
+
# last non-empty line in the file. We just check the
|
| 146 |
+
# first header entry.
|
| 147 |
+
if key != b'StartFontMetrics':
|
| 148 |
+
raise RuntimeError('Not an AFM file')
|
| 149 |
+
first_line = False
|
| 150 |
+
if len(lst) == 2:
|
| 151 |
+
val = lst[1]
|
| 152 |
+
else:
|
| 153 |
+
val = b''
|
| 154 |
+
try:
|
| 155 |
+
converter = header_converters[key]
|
| 156 |
+
except KeyError:
|
| 157 |
+
_log.error("Found an unknown keyword in AFM header (was %r)", key)
|
| 158 |
+
continue
|
| 159 |
+
try:
|
| 160 |
+
d[key] = converter(val)
|
| 161 |
+
except ValueError:
|
| 162 |
+
_log.error('Value error parsing header in AFM: %s, %s', key, val)
|
| 163 |
+
continue
|
| 164 |
+
if key == b'StartCharMetrics':
|
| 165 |
+
break
|
| 166 |
+
else:
|
| 167 |
+
raise RuntimeError('Bad parse')
|
| 168 |
+
return d
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
CharMetrics = namedtuple('CharMetrics', 'width, name, bbox')
|
| 172 |
+
CharMetrics.__doc__ = """
|
| 173 |
+
Represents the character metrics of a single character.
|
| 174 |
+
|
| 175 |
+
Notes
|
| 176 |
+
-----
|
| 177 |
+
The fields do currently only describe a subset of character metrics
|
| 178 |
+
information defined in the AFM standard.
|
| 179 |
+
"""
|
| 180 |
+
CharMetrics.width.__doc__ = """The character width (WX)."""
|
| 181 |
+
CharMetrics.name.__doc__ = """The character name (N)."""
|
| 182 |
+
CharMetrics.bbox.__doc__ = """
|
| 183 |
+
The bbox of the character (B) as a tuple (*llx*, *lly*, *urx*, *ury*)."""
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
def _parse_char_metrics(fh):
|
| 187 |
+
"""
|
| 188 |
+
Parse the given filehandle for character metrics information and return
|
| 189 |
+
the information as dicts.
|
| 190 |
+
|
| 191 |
+
It is assumed that the file cursor is on the line behind
|
| 192 |
+
'StartCharMetrics'.
|
| 193 |
+
|
| 194 |
+
Returns
|
| 195 |
+
-------
|
| 196 |
+
ascii_d : dict
|
| 197 |
+
A mapping "ASCII num of the character" to `.CharMetrics`.
|
| 198 |
+
name_d : dict
|
| 199 |
+
A mapping "character name" to `.CharMetrics`.
|
| 200 |
+
|
| 201 |
+
Notes
|
| 202 |
+
-----
|
| 203 |
+
This function is incomplete per the standard, but thus far parses
|
| 204 |
+
all the sample afm files tried.
|
| 205 |
+
"""
|
| 206 |
+
required_keys = {'C', 'WX', 'N', 'B'}
|
| 207 |
+
|
| 208 |
+
ascii_d = {}
|
| 209 |
+
name_d = {}
|
| 210 |
+
for line in fh:
|
| 211 |
+
# We are defensively letting values be utf8. The spec requires
|
| 212 |
+
# ascii, but there are non-compliant fonts in circulation
|
| 213 |
+
line = _to_str(line.rstrip()) # Convert from byte-literal
|
| 214 |
+
if line.startswith('EndCharMetrics'):
|
| 215 |
+
return ascii_d, name_d
|
| 216 |
+
# Split the metric line into a dictionary, keyed by metric identifiers
|
| 217 |
+
vals = dict(s.strip().split(' ', 1) for s in line.split(';') if s)
|
| 218 |
+
# There may be other metrics present, but only these are needed
|
| 219 |
+
if not required_keys.issubset(vals):
|
| 220 |
+
raise RuntimeError('Bad char metrics line: %s' % line)
|
| 221 |
+
num = _to_int(vals['C'])
|
| 222 |
+
wx = _to_float(vals['WX'])
|
| 223 |
+
name = vals['N']
|
| 224 |
+
bbox = _to_list_of_floats(vals['B'])
|
| 225 |
+
bbox = list(map(int, bbox))
|
| 226 |
+
metrics = CharMetrics(wx, name, bbox)
|
| 227 |
+
# Workaround: If the character name is 'Euro', give it the
|
| 228 |
+
# corresponding character code, according to WinAnsiEncoding (see PDF
|
| 229 |
+
# Reference).
|
| 230 |
+
if name == 'Euro':
|
| 231 |
+
num = 128
|
| 232 |
+
elif name == 'minus':
|
| 233 |
+
num = ord("\N{MINUS SIGN}") # 0x2212
|
| 234 |
+
if num != -1:
|
| 235 |
+
ascii_d[num] = metrics
|
| 236 |
+
name_d[name] = metrics
|
| 237 |
+
raise RuntimeError('Bad parse')
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
def _parse_kern_pairs(fh):
|
| 241 |
+
"""
|
| 242 |
+
Return a kern pairs dictionary; keys are (*char1*, *char2*) tuples and
|
| 243 |
+
values are the kern pair value. For example, a kern pairs line like
|
| 244 |
+
``KPX A y -50``
|
| 245 |
+
|
| 246 |
+
will be represented as::
|
| 247 |
+
|
| 248 |
+
d[ ('A', 'y') ] = -50
|
| 249 |
+
|
| 250 |
+
"""
|
| 251 |
+
|
| 252 |
+
line = next(fh)
|
| 253 |
+
if not line.startswith(b'StartKernPairs'):
|
| 254 |
+
raise RuntimeError('Bad start of kern pairs data: %s' % line)
|
| 255 |
+
|
| 256 |
+
d = {}
|
| 257 |
+
for line in fh:
|
| 258 |
+
line = line.rstrip()
|
| 259 |
+
if not line:
|
| 260 |
+
continue
|
| 261 |
+
if line.startswith(b'EndKernPairs'):
|
| 262 |
+
next(fh) # EndKernData
|
| 263 |
+
return d
|
| 264 |
+
vals = line.split()
|
| 265 |
+
if len(vals) != 4 or vals[0] != b'KPX':
|
| 266 |
+
raise RuntimeError('Bad kern pairs line: %s' % line)
|
| 267 |
+
c1, c2, val = _to_str(vals[1]), _to_str(vals[2]), _to_float(vals[3])
|
| 268 |
+
d[(c1, c2)] = val
|
| 269 |
+
raise RuntimeError('Bad kern pairs parse')
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
CompositePart = namedtuple('CompositePart', 'name, dx, dy')
|
| 273 |
+
CompositePart.__doc__ = """
|
| 274 |
+
Represents the information on a composite element of a composite char."""
|
| 275 |
+
CompositePart.name.__doc__ = """Name of the part, e.g. 'acute'."""
|
| 276 |
+
CompositePart.dx.__doc__ = """x-displacement of the part from the origin."""
|
| 277 |
+
CompositePart.dy.__doc__ = """y-displacement of the part from the origin."""
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def _parse_composites(fh):
|
| 281 |
+
"""
|
| 282 |
+
Parse the given filehandle for composites information return them as a
|
| 283 |
+
dict.
|
| 284 |
+
|
| 285 |
+
It is assumed that the file cursor is on the line behind 'StartComposites'.
|
| 286 |
+
|
| 287 |
+
Returns
|
| 288 |
+
-------
|
| 289 |
+
dict
|
| 290 |
+
A dict mapping composite character names to a parts list. The parts
|
| 291 |
+
list is a list of `.CompositePart` entries describing the parts of
|
| 292 |
+
the composite.
|
| 293 |
+
|
| 294 |
+
Examples
|
| 295 |
+
--------
|
| 296 |
+
A composite definition line::
|
| 297 |
+
|
| 298 |
+
CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 170 ;
|
| 299 |
+
|
| 300 |
+
will be represented as::
|
| 301 |
+
|
| 302 |
+
composites['Aacute'] = [CompositePart(name='A', dx=0, dy=0),
|
| 303 |
+
CompositePart(name='acute', dx=160, dy=170)]
|
| 304 |
+
|
| 305 |
+
"""
|
| 306 |
+
composites = {}
|
| 307 |
+
for line in fh:
|
| 308 |
+
line = line.rstrip()
|
| 309 |
+
if not line:
|
| 310 |
+
continue
|
| 311 |
+
if line.startswith(b'EndComposites'):
|
| 312 |
+
return composites
|
| 313 |
+
vals = line.split(b';')
|
| 314 |
+
cc = vals[0].split()
|
| 315 |
+
name, _num_parts = cc[1], _to_int(cc[2])
|
| 316 |
+
pccParts = []
|
| 317 |
+
for s in vals[1:-1]:
|
| 318 |
+
pcc = s.split()
|
| 319 |
+
part = CompositePart(pcc[1], _to_float(pcc[2]), _to_float(pcc[3]))
|
| 320 |
+
pccParts.append(part)
|
| 321 |
+
composites[name] = pccParts
|
| 322 |
+
|
| 323 |
+
raise RuntimeError('Bad composites parse')
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
def _parse_optional(fh):
|
| 327 |
+
"""
|
| 328 |
+
Parse the optional fields for kern pair data and composites.
|
| 329 |
+
|
| 330 |
+
Returns
|
| 331 |
+
-------
|
| 332 |
+
kern_data : dict
|
| 333 |
+
A dict containing kerning information. May be empty.
|
| 334 |
+
See `._parse_kern_pairs`.
|
| 335 |
+
composites : dict
|
| 336 |
+
A dict containing composite information. May be empty.
|
| 337 |
+
See `._parse_composites`.
|
| 338 |
+
"""
|
| 339 |
+
optional = {
|
| 340 |
+
b'StartKernData': _parse_kern_pairs,
|
| 341 |
+
b'StartComposites': _parse_composites,
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
d = {b'StartKernData': {},
|
| 345 |
+
b'StartComposites': {}}
|
| 346 |
+
for line in fh:
|
| 347 |
+
line = line.rstrip()
|
| 348 |
+
if not line:
|
| 349 |
+
continue
|
| 350 |
+
key = line.split()[0]
|
| 351 |
+
|
| 352 |
+
if key in optional:
|
| 353 |
+
d[key] = optional[key](fh)
|
| 354 |
+
|
| 355 |
+
return d[b'StartKernData'], d[b'StartComposites']
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
class AFM:
|
| 359 |
+
|
| 360 |
+
def __init__(self, fh):
|
| 361 |
+
"""Parse the AFM file in file object *fh*."""
|
| 362 |
+
self._header = _parse_header(fh)
|
| 363 |
+
self._metrics, self._metrics_by_name = _parse_char_metrics(fh)
|
| 364 |
+
self._kern, self._composite = _parse_optional(fh)
|
| 365 |
+
|
| 366 |
+
def get_bbox_char(self, c, isord=False):
|
| 367 |
+
if not isord:
|
| 368 |
+
c = ord(c)
|
| 369 |
+
return self._metrics[c].bbox
|
| 370 |
+
|
| 371 |
+
def string_width_height(self, s):
|
| 372 |
+
"""
|
| 373 |
+
Return the string width (including kerning) and string height
|
| 374 |
+
as a (*w*, *h*) tuple.
|
| 375 |
+
"""
|
| 376 |
+
if not len(s):
|
| 377 |
+
return 0, 0
|
| 378 |
+
total_width = 0
|
| 379 |
+
namelast = None
|
| 380 |
+
miny = 1e9
|
| 381 |
+
maxy = 0
|
| 382 |
+
for c in s:
|
| 383 |
+
if c == '\n':
|
| 384 |
+
continue
|
| 385 |
+
wx, name, bbox = self._metrics[ord(c)]
|
| 386 |
+
|
| 387 |
+
total_width += wx + self._kern.get((namelast, name), 0)
|
| 388 |
+
l, b, w, h = bbox
|
| 389 |
+
miny = min(miny, b)
|
| 390 |
+
maxy = max(maxy, b + h)
|
| 391 |
+
|
| 392 |
+
namelast = name
|
| 393 |
+
|
| 394 |
+
return total_width, maxy - miny
|
| 395 |
+
|
| 396 |
+
def get_str_bbox_and_descent(self, s):
|
| 397 |
+
"""Return the string bounding box and the maximal descent."""
|
| 398 |
+
if not len(s):
|
| 399 |
+
return 0, 0, 0, 0, 0
|
| 400 |
+
total_width = 0
|
| 401 |
+
namelast = None
|
| 402 |
+
miny = 1e9
|
| 403 |
+
maxy = 0
|
| 404 |
+
left = 0
|
| 405 |
+
if not isinstance(s, str):
|
| 406 |
+
s = _to_str(s)
|
| 407 |
+
for c in s:
|
| 408 |
+
if c == '\n':
|
| 409 |
+
continue
|
| 410 |
+
name = uni2type1.get(ord(c), f"uni{ord(c):04X}")
|
| 411 |
+
try:
|
| 412 |
+
wx, _, bbox = self._metrics_by_name[name]
|
| 413 |
+
except KeyError:
|
| 414 |
+
name = 'question'
|
| 415 |
+
wx, _, bbox = self._metrics_by_name[name]
|
| 416 |
+
total_width += wx + self._kern.get((namelast, name), 0)
|
| 417 |
+
l, b, w, h = bbox
|
| 418 |
+
left = min(left, l)
|
| 419 |
+
miny = min(miny, b)
|
| 420 |
+
maxy = max(maxy, b + h)
|
| 421 |
+
|
| 422 |
+
namelast = name
|
| 423 |
+
|
| 424 |
+
return left, miny, total_width, maxy - miny, -miny
|
| 425 |
+
|
| 426 |
+
def get_str_bbox(self, s):
|
| 427 |
+
"""Return the string bounding box."""
|
| 428 |
+
return self.get_str_bbox_and_descent(s)[:4]
|
| 429 |
+
|
| 430 |
+
def get_name_char(self, c, isord=False):
|
| 431 |
+
"""Get the name of the character, i.e., ';' is 'semicolon'."""
|
| 432 |
+
if not isord:
|
| 433 |
+
c = ord(c)
|
| 434 |
+
return self._metrics[c].name
|
| 435 |
+
|
| 436 |
+
def get_width_char(self, c, isord=False):
|
| 437 |
+
"""
|
| 438 |
+
Get the width of the character from the character metric WX field.
|
| 439 |
+
"""
|
| 440 |
+
if not isord:
|
| 441 |
+
c = ord(c)
|
| 442 |
+
return self._metrics[c].width
|
| 443 |
+
|
| 444 |
+
def get_width_from_char_name(self, name):
|
| 445 |
+
"""Get the width of the character from a type1 character name."""
|
| 446 |
+
return self._metrics_by_name[name].width
|
| 447 |
+
|
| 448 |
+
def get_height_char(self, c, isord=False):
|
| 449 |
+
"""Get the bounding box (ink) height of character *c* (space is 0)."""
|
| 450 |
+
if not isord:
|
| 451 |
+
c = ord(c)
|
| 452 |
+
return self._metrics[c].bbox[-1]
|
| 453 |
+
|
| 454 |
+
def get_kern_dist(self, c1, c2):
|
| 455 |
+
"""
|
| 456 |
+
Return the kerning pair distance (possibly 0) for chars *c1* and *c2*.
|
| 457 |
+
"""
|
| 458 |
+
name1, name2 = self.get_name_char(c1), self.get_name_char(c2)
|
| 459 |
+
return self.get_kern_dist_from_name(name1, name2)
|
| 460 |
+
|
| 461 |
+
def get_kern_dist_from_name(self, name1, name2):
|
| 462 |
+
"""
|
| 463 |
+
Return the kerning pair distance (possibly 0) for chars
|
| 464 |
+
*name1* and *name2*.
|
| 465 |
+
"""
|
| 466 |
+
return self._kern.get((name1, name2), 0)
|
| 467 |
+
|
| 468 |
+
def get_fontname(self):
|
| 469 |
+
"""Return the font name, e.g., 'Times-Roman'."""
|
| 470 |
+
return self._header[b'FontName']
|
| 471 |
+
|
| 472 |
+
@property
|
| 473 |
+
def postscript_name(self): # For consistency with FT2Font.
|
| 474 |
+
return self.get_fontname()
|
| 475 |
+
|
| 476 |
+
def get_fullname(self):
|
| 477 |
+
"""Return the font full name, e.g., 'Times-Roman'."""
|
| 478 |
+
name = self._header.get(b'FullName')
|
| 479 |
+
if name is None: # use FontName as a substitute
|
| 480 |
+
name = self._header[b'FontName']
|
| 481 |
+
return name
|
| 482 |
+
|
| 483 |
+
def get_familyname(self):
|
| 484 |
+
"""Return the font family name, e.g., 'Times'."""
|
| 485 |
+
name = self._header.get(b'FamilyName')
|
| 486 |
+
if name is not None:
|
| 487 |
+
return name
|
| 488 |
+
|
| 489 |
+
# FamilyName not specified so we'll make a guess
|
| 490 |
+
name = self.get_fullname()
|
| 491 |
+
extras = (r'(?i)([ -](regular|plain|italic|oblique|bold|semibold|'
|
| 492 |
+
r'light|ultralight|extra|condensed))+$')
|
| 493 |
+
return re.sub(extras, '', name)
|
| 494 |
+
|
| 495 |
+
@property
|
| 496 |
+
def family_name(self):
|
| 497 |
+
"""The font family name, e.g., 'Times'."""
|
| 498 |
+
return self.get_familyname()
|
| 499 |
+
|
| 500 |
+
def get_weight(self):
|
| 501 |
+
"""Return the font weight, e.g., 'Bold' or 'Roman'."""
|
| 502 |
+
return self._header[b'Weight']
|
| 503 |
+
|
| 504 |
+
def get_angle(self):
|
| 505 |
+
"""Return the fontangle as float."""
|
| 506 |
+
return self._header[b'ItalicAngle']
|
| 507 |
+
|
| 508 |
+
def get_capheight(self):
|
| 509 |
+
"""Return the cap height as float."""
|
| 510 |
+
return self._header[b'CapHeight']
|
| 511 |
+
|
| 512 |
+
def get_xheight(self):
|
| 513 |
+
"""Return the xheight as float."""
|
| 514 |
+
return self._header[b'XHeight']
|
| 515 |
+
|
| 516 |
+
def get_underline_thickness(self):
|
| 517 |
+
"""Return the underline thickness as float."""
|
| 518 |
+
return self._header[b'UnderlineThickness']
|
| 519 |
+
|
| 520 |
+
def get_horizontal_stem_width(self):
|
| 521 |
+
"""
|
| 522 |
+
Return the standard horizontal stem width as float, or *None* if
|
| 523 |
+
not specified in AFM file.
|
| 524 |
+
"""
|
| 525 |
+
return self._header.get(b'StdHW', None)
|
| 526 |
+
|
| 527 |
+
def get_vertical_stem_width(self):
|
| 528 |
+
"""
|
| 529 |
+
Return the standard vertical stem width as float, or *None* if
|
| 530 |
+
not specified in AFM file.
|
| 531 |
+
"""
|
| 532 |
+
return self._header.get(b'StdVW', None)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_animation_data.py
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# JavaScript template for HTMLWriter
|
| 2 |
+
JS_INCLUDE = """
|
| 3 |
+
<link rel="stylesheet"
|
| 4 |
+
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
| 5 |
+
<script language="javascript">
|
| 6 |
+
function isInternetExplorer() {
|
| 7 |
+
ua = navigator.userAgent;
|
| 8 |
+
/* MSIE used to detect old browsers and Trident used to newer ones*/
|
| 9 |
+
return ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/* Define the Animation class */
|
| 13 |
+
function Animation(frames, img_id, slider_id, interval, loop_select_id){
|
| 14 |
+
this.img_id = img_id;
|
| 15 |
+
this.slider_id = slider_id;
|
| 16 |
+
this.loop_select_id = loop_select_id;
|
| 17 |
+
this.interval = interval;
|
| 18 |
+
this.current_frame = 0;
|
| 19 |
+
this.direction = 0;
|
| 20 |
+
this.timer = null;
|
| 21 |
+
this.frames = new Array(frames.length);
|
| 22 |
+
|
| 23 |
+
for (var i=0; i<frames.length; i++)
|
| 24 |
+
{
|
| 25 |
+
this.frames[i] = new Image();
|
| 26 |
+
this.frames[i].src = frames[i];
|
| 27 |
+
}
|
| 28 |
+
var slider = document.getElementById(this.slider_id);
|
| 29 |
+
slider.max = this.frames.length - 1;
|
| 30 |
+
if (isInternetExplorer()) {
|
| 31 |
+
// switch from oninput to onchange because IE <= 11 does not conform
|
| 32 |
+
// with W3C specification. It ignores oninput and onchange behaves
|
| 33 |
+
// like oninput. In contrast, Microsoft Edge behaves correctly.
|
| 34 |
+
slider.setAttribute('onchange', slider.getAttribute('oninput'));
|
| 35 |
+
slider.setAttribute('oninput', null);
|
| 36 |
+
}
|
| 37 |
+
this.set_frame(this.current_frame);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
Animation.prototype.get_loop_state = function(){
|
| 41 |
+
var button_group = document[this.loop_select_id].state;
|
| 42 |
+
for (var i = 0; i < button_group.length; i++) {
|
| 43 |
+
var button = button_group[i];
|
| 44 |
+
if (button.checked) {
|
| 45 |
+
return button.value;
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
return undefined;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
Animation.prototype.set_frame = function(frame){
|
| 52 |
+
this.current_frame = frame;
|
| 53 |
+
document.getElementById(this.img_id).src =
|
| 54 |
+
this.frames[this.current_frame].src;
|
| 55 |
+
document.getElementById(this.slider_id).value = this.current_frame;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
Animation.prototype.next_frame = function()
|
| 59 |
+
{
|
| 60 |
+
this.set_frame(Math.min(this.frames.length - 1, this.current_frame + 1));
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
Animation.prototype.previous_frame = function()
|
| 64 |
+
{
|
| 65 |
+
this.set_frame(Math.max(0, this.current_frame - 1));
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
Animation.prototype.first_frame = function()
|
| 69 |
+
{
|
| 70 |
+
this.set_frame(0);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
Animation.prototype.last_frame = function()
|
| 74 |
+
{
|
| 75 |
+
this.set_frame(this.frames.length - 1);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
Animation.prototype.slower = function()
|
| 79 |
+
{
|
| 80 |
+
this.interval /= 0.7;
|
| 81 |
+
if(this.direction > 0){this.play_animation();}
|
| 82 |
+
else if(this.direction < 0){this.reverse_animation();}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
Animation.prototype.faster = function()
|
| 86 |
+
{
|
| 87 |
+
this.interval *= 0.7;
|
| 88 |
+
if(this.direction > 0){this.play_animation();}
|
| 89 |
+
else if(this.direction < 0){this.reverse_animation();}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
Animation.prototype.anim_step_forward = function()
|
| 93 |
+
{
|
| 94 |
+
this.current_frame += 1;
|
| 95 |
+
if(this.current_frame < this.frames.length){
|
| 96 |
+
this.set_frame(this.current_frame);
|
| 97 |
+
}else{
|
| 98 |
+
var loop_state = this.get_loop_state();
|
| 99 |
+
if(loop_state == "loop"){
|
| 100 |
+
this.first_frame();
|
| 101 |
+
}else if(loop_state == "reflect"){
|
| 102 |
+
this.last_frame();
|
| 103 |
+
this.reverse_animation();
|
| 104 |
+
}else{
|
| 105 |
+
this.pause_animation();
|
| 106 |
+
this.last_frame();
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
Animation.prototype.anim_step_reverse = function()
|
| 112 |
+
{
|
| 113 |
+
this.current_frame -= 1;
|
| 114 |
+
if(this.current_frame >= 0){
|
| 115 |
+
this.set_frame(this.current_frame);
|
| 116 |
+
}else{
|
| 117 |
+
var loop_state = this.get_loop_state();
|
| 118 |
+
if(loop_state == "loop"){
|
| 119 |
+
this.last_frame();
|
| 120 |
+
}else if(loop_state == "reflect"){
|
| 121 |
+
this.first_frame();
|
| 122 |
+
this.play_animation();
|
| 123 |
+
}else{
|
| 124 |
+
this.pause_animation();
|
| 125 |
+
this.first_frame();
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
Animation.prototype.pause_animation = function()
|
| 131 |
+
{
|
| 132 |
+
this.direction = 0;
|
| 133 |
+
if (this.timer){
|
| 134 |
+
clearInterval(this.timer);
|
| 135 |
+
this.timer = null;
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
Animation.prototype.play_animation = function()
|
| 140 |
+
{
|
| 141 |
+
this.pause_animation();
|
| 142 |
+
this.direction = 1;
|
| 143 |
+
var t = this;
|
| 144 |
+
if (!this.timer) this.timer = setInterval(function() {
|
| 145 |
+
t.anim_step_forward();
|
| 146 |
+
}, this.interval);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
Animation.prototype.reverse_animation = function()
|
| 150 |
+
{
|
| 151 |
+
this.pause_animation();
|
| 152 |
+
this.direction = -1;
|
| 153 |
+
var t = this;
|
| 154 |
+
if (!this.timer) this.timer = setInterval(function() {
|
| 155 |
+
t.anim_step_reverse();
|
| 156 |
+
}, this.interval);
|
| 157 |
+
}
|
| 158 |
+
</script>
|
| 159 |
+
"""
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
# Style definitions for the HTML template
|
| 163 |
+
STYLE_INCLUDE = """
|
| 164 |
+
<style>
|
| 165 |
+
.animation {
|
| 166 |
+
display: inline-block;
|
| 167 |
+
text-align: center;
|
| 168 |
+
}
|
| 169 |
+
input[type=range].anim-slider {
|
| 170 |
+
width: 374px;
|
| 171 |
+
margin-left: auto;
|
| 172 |
+
margin-right: auto;
|
| 173 |
+
}
|
| 174 |
+
.anim-buttons {
|
| 175 |
+
margin: 8px 0px;
|
| 176 |
+
}
|
| 177 |
+
.anim-buttons button {
|
| 178 |
+
padding: 0;
|
| 179 |
+
width: 36px;
|
| 180 |
+
}
|
| 181 |
+
.anim-state label {
|
| 182 |
+
margin-right: 8px;
|
| 183 |
+
}
|
| 184 |
+
.anim-state input {
|
| 185 |
+
margin: 0;
|
| 186 |
+
vertical-align: middle;
|
| 187 |
+
}
|
| 188 |
+
</style>
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
# HTML template for HTMLWriter
|
| 193 |
+
DISPLAY_TEMPLATE = """
|
| 194 |
+
<div class="animation">
|
| 195 |
+
<img id="_anim_img{id}">
|
| 196 |
+
<div class="anim-controls">
|
| 197 |
+
<input id="_anim_slider{id}" type="range" class="anim-slider"
|
| 198 |
+
name="points" min="0" max="1" step="1" value="0"
|
| 199 |
+
oninput="anim{id}.set_frame(parseInt(this.value));">
|
| 200 |
+
<div class="anim-buttons">
|
| 201 |
+
<button title="Decrease speed" aria-label="Decrease speed" onclick="anim{id}.slower()">
|
| 202 |
+
<i class="fa fa-minus"></i></button>
|
| 203 |
+
<button title="First frame" aria-label="First frame" onclick="anim{id}.first_frame()">
|
| 204 |
+
<i class="fa fa-fast-backward"></i></button>
|
| 205 |
+
<button title="Previous frame" aria-label="Previous frame" onclick="anim{id}.previous_frame()">
|
| 206 |
+
<i class="fa fa-step-backward"></i></button>
|
| 207 |
+
<button title="Play backwards" aria-label="Play backwards" onclick="anim{id}.reverse_animation()">
|
| 208 |
+
<i class="fa fa-play fa-flip-horizontal"></i></button>
|
| 209 |
+
<button title="Pause" aria-label="Pause" onclick="anim{id}.pause_animation()">
|
| 210 |
+
<i class="fa fa-pause"></i></button>
|
| 211 |
+
<button title="Play" aria-label="Play" onclick="anim{id}.play_animation()">
|
| 212 |
+
<i class="fa fa-play"></i></button>
|
| 213 |
+
<button title="Next frame" aria-label="Next frame" onclick="anim{id}.next_frame()">
|
| 214 |
+
<i class="fa fa-step-forward"></i></button>
|
| 215 |
+
<button title="Last frame" aria-label="Last frame" onclick="anim{id}.last_frame()">
|
| 216 |
+
<i class="fa fa-fast-forward"></i></button>
|
| 217 |
+
<button title="Increase speed" aria-label="Increase speed" onclick="anim{id}.faster()">
|
| 218 |
+
<i class="fa fa-plus"></i></button>
|
| 219 |
+
</div>
|
| 220 |
+
<form title="Repetition mode" aria-label="Repetition mode" action="#n" name="_anim_loop_select{id}"
|
| 221 |
+
class="anim-state">
|
| 222 |
+
<input type="radio" name="state" value="once" id="_anim_radio1_{id}"
|
| 223 |
+
{once_checked}>
|
| 224 |
+
<label for="_anim_radio1_{id}">Once</label>
|
| 225 |
+
<input type="radio" name="state" value="loop" id="_anim_radio2_{id}"
|
| 226 |
+
{loop_checked}>
|
| 227 |
+
<label for="_anim_radio2_{id}">Loop</label>
|
| 228 |
+
<input type="radio" name="state" value="reflect" id="_anim_radio3_{id}"
|
| 229 |
+
{reflect_checked}>
|
| 230 |
+
<label for="_anim_radio3_{id}">Reflect</label>
|
| 231 |
+
</form>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
<script language="javascript">
|
| 237 |
+
/* Instantiate the Animation class. */
|
| 238 |
+
/* The IDs given should match those used in the template above. */
|
| 239 |
+
(function() {{
|
| 240 |
+
var img_id = "_anim_img{id}";
|
| 241 |
+
var slider_id = "_anim_slider{id}";
|
| 242 |
+
var loop_select_id = "_anim_loop_select{id}";
|
| 243 |
+
var frames = new Array({Nframes});
|
| 244 |
+
{fill_frames}
|
| 245 |
+
|
| 246 |
+
/* set a timeout to make sure all the above elements are created before
|
| 247 |
+
the object is initialized. */
|
| 248 |
+
setTimeout(function() {{
|
| 249 |
+
anim{id} = new Animation(frames, img_id, slider_id, {interval},
|
| 250 |
+
loop_select_id);
|
| 251 |
+
}}, 0);
|
| 252 |
+
}})()
|
| 253 |
+
</script>
|
| 254 |
+
""" # noqa: E501
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
INCLUDED_FRAMES = """
|
| 258 |
+
for (var i=0; i<{Nframes}; i++){{
|
| 259 |
+
frames[i] = "{frame_dir}/frame" + ("0000000" + i).slice(-7) +
|
| 260 |
+
".{frame_format}";
|
| 261 |
+
}}
|
| 262 |
+
"""
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_blocking_input.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def blocking_input_loop(figure, event_names, timeout, handler):
|
| 2 |
+
"""
|
| 3 |
+
Run *figure*'s event loop while listening to interactive events.
|
| 4 |
+
|
| 5 |
+
The events listed in *event_names* are passed to *handler*.
|
| 6 |
+
|
| 7 |
+
This function is used to implement `.Figure.waitforbuttonpress`,
|
| 8 |
+
`.Figure.ginput`, and `.Axes.clabel`.
|
| 9 |
+
|
| 10 |
+
Parameters
|
| 11 |
+
----------
|
| 12 |
+
figure : `~matplotlib.figure.Figure`
|
| 13 |
+
event_names : list of str
|
| 14 |
+
The names of the events passed to *handler*.
|
| 15 |
+
timeout : float
|
| 16 |
+
If positive, the event loop is stopped after *timeout* seconds.
|
| 17 |
+
handler : Callable[[Event], Any]
|
| 18 |
+
Function called for each event; it can force an early exit of the event
|
| 19 |
+
loop by calling ``canvas.stop_event_loop()``.
|
| 20 |
+
"""
|
| 21 |
+
if figure.canvas.manager:
|
| 22 |
+
figure.show() # Ensure that the figure is shown if we are managing it.
|
| 23 |
+
# Connect the events to the on_event function call.
|
| 24 |
+
cids = [figure.canvas.mpl_connect(name, handler) for name in event_names]
|
| 25 |
+
try:
|
| 26 |
+
figure.canvas.start_event_loop(timeout) # Start event loop.
|
| 27 |
+
finally: # Run even on exception like ctrl-c.
|
| 28 |
+
# Disconnect the callbacks.
|
| 29 |
+
for cid in cids:
|
| 30 |
+
figure.canvas.mpl_disconnect(cid)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_c_internal_utils.pyi
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def display_is_valid() -> bool: ...
|
| 2 |
+
def xdisplay_is_valid() -> bool: ...
|
| 3 |
+
|
| 4 |
+
def Win32_GetForegroundWindow() -> int | None: ...
|
| 5 |
+
def Win32_SetForegroundWindow(hwnd: int) -> None: ...
|
| 6 |
+
def Win32_SetProcessDpiAwareness_max() -> None: ...
|
| 7 |
+
def Win32_SetCurrentProcessExplicitAppUserModelID(appid: str) -> None: ...
|
| 8 |
+
def Win32_GetCurrentProcessExplicitAppUserModelID() -> str | None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm.py
ADDED
|
@@ -0,0 +1,1460 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
and a dictionary of these dictionaries.
|
| 4 |
+
|
| 5 |
+
Documentation for each is in pyplot.colormaps(). Please update this
|
| 6 |
+
with the purpose and type of your colormap if you add data for one here.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from functools import partial
|
| 10 |
+
|
| 11 |
+
import numpy as np
|
| 12 |
+
|
| 13 |
+
_binary_data = {
|
| 14 |
+
'red': ((0., 1., 1.), (1., 0., 0.)),
|
| 15 |
+
'green': ((0., 1., 1.), (1., 0., 0.)),
|
| 16 |
+
'blue': ((0., 1., 1.), (1., 0., 0.))
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
_autumn_data = {'red': ((0., 1.0, 1.0), (1.0, 1.0, 1.0)),
|
| 20 |
+
'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
|
| 21 |
+
'blue': ((0., 0., 0.), (1.0, 0., 0.))}
|
| 22 |
+
|
| 23 |
+
_bone_data = {'red': ((0., 0., 0.),
|
| 24 |
+
(0.746032, 0.652778, 0.652778),
|
| 25 |
+
(1.0, 1.0, 1.0)),
|
| 26 |
+
'green': ((0., 0., 0.),
|
| 27 |
+
(0.365079, 0.319444, 0.319444),
|
| 28 |
+
(0.746032, 0.777778, 0.777778),
|
| 29 |
+
(1.0, 1.0, 1.0)),
|
| 30 |
+
'blue': ((0., 0., 0.),
|
| 31 |
+
(0.365079, 0.444444, 0.444444),
|
| 32 |
+
(1.0, 1.0, 1.0))}
|
| 33 |
+
|
| 34 |
+
_cool_data = {'red': ((0., 0., 0.), (1.0, 1.0, 1.0)),
|
| 35 |
+
'green': ((0., 1., 1.), (1.0, 0., 0.)),
|
| 36 |
+
'blue': ((0., 1., 1.), (1.0, 1., 1.))}
|
| 37 |
+
|
| 38 |
+
_copper_data = {'red': ((0., 0., 0.),
|
| 39 |
+
(0.809524, 1.000000, 1.000000),
|
| 40 |
+
(1.0, 1.0, 1.0)),
|
| 41 |
+
'green': ((0., 0., 0.),
|
| 42 |
+
(1.0, 0.7812, 0.7812)),
|
| 43 |
+
'blue': ((0., 0., 0.),
|
| 44 |
+
(1.0, 0.4975, 0.4975))}
|
| 45 |
+
|
| 46 |
+
def _flag_red(x): return 0.75 * np.sin((x * 31.5 + 0.25) * np.pi) + 0.5
|
| 47 |
+
def _flag_green(x): return np.sin(x * 31.5 * np.pi)
|
| 48 |
+
def _flag_blue(x): return 0.75 * np.sin((x * 31.5 - 0.25) * np.pi) + 0.5
|
| 49 |
+
_flag_data = {'red': _flag_red, 'green': _flag_green, 'blue': _flag_blue}
|
| 50 |
+
|
| 51 |
+
def _prism_red(x): return 0.75 * np.sin((x * 20.9 + 0.25) * np.pi) + 0.67
|
| 52 |
+
def _prism_green(x): return 0.75 * np.sin((x * 20.9 - 0.25) * np.pi) + 0.33
|
| 53 |
+
def _prism_blue(x): return -1.1 * np.sin((x * 20.9) * np.pi)
|
| 54 |
+
_prism_data = {'red': _prism_red, 'green': _prism_green, 'blue': _prism_blue}
|
| 55 |
+
|
| 56 |
+
def _ch_helper(gamma, s, r, h, p0, p1, x):
|
| 57 |
+
"""Helper function for generating picklable cubehelix colormaps."""
|
| 58 |
+
# Apply gamma factor to emphasise low or high intensity values
|
| 59 |
+
xg = x ** gamma
|
| 60 |
+
# Calculate amplitude and angle of deviation from the black to white
|
| 61 |
+
# diagonal in the plane of constant perceived intensity.
|
| 62 |
+
a = h * xg * (1 - xg) / 2
|
| 63 |
+
phi = 2 * np.pi * (s / 3 + r * x)
|
| 64 |
+
return xg + a * (p0 * np.cos(phi) + p1 * np.sin(phi))
|
| 65 |
+
|
| 66 |
+
def cubehelix(gamma=1.0, s=0.5, r=-1.5, h=1.0):
|
| 67 |
+
"""
|
| 68 |
+
Return custom data dictionary of (r, g, b) conversion functions, which can
|
| 69 |
+
be used with `.ColormapRegistry.register`, for the cubehelix color scheme.
|
| 70 |
+
|
| 71 |
+
Unlike most other color schemes cubehelix was designed by D.A. Green to
|
| 72 |
+
be monotonically increasing in terms of perceived brightness.
|
| 73 |
+
Also, when printed on a black and white postscript printer, the scheme
|
| 74 |
+
results in a greyscale with monotonically increasing brightness.
|
| 75 |
+
This color scheme is named cubehelix because the (r, g, b) values produced
|
| 76 |
+
can be visualised as a squashed helix around the diagonal in the
|
| 77 |
+
(r, g, b) color cube.
|
| 78 |
+
|
| 79 |
+
For a unit color cube (i.e. 3D coordinates for (r, g, b) each in the
|
| 80 |
+
range 0 to 1) the color scheme starts at (r, g, b) = (0, 0, 0), i.e. black,
|
| 81 |
+
and finishes at (r, g, b) = (1, 1, 1), i.e. white. For some fraction *x*,
|
| 82 |
+
between 0 and 1, the color is the corresponding grey value at that
|
| 83 |
+
fraction along the black to white diagonal (x, x, x) plus a color
|
| 84 |
+
element. This color element is calculated in a plane of constant
|
| 85 |
+
perceived intensity and controlled by the following parameters.
|
| 86 |
+
|
| 87 |
+
Parameters
|
| 88 |
+
----------
|
| 89 |
+
gamma : float, default: 1
|
| 90 |
+
Gamma factor emphasizing either low intensity values (gamma < 1), or
|
| 91 |
+
high intensity values (gamma > 1).
|
| 92 |
+
s : float, default: 0.5 (purple)
|
| 93 |
+
The starting color.
|
| 94 |
+
r : float, default: -1.5
|
| 95 |
+
The number of r, g, b rotations in color that are made from the start
|
| 96 |
+
to the end of the color scheme. The default of -1.5 corresponds to ->
|
| 97 |
+
B -> G -> R -> B.
|
| 98 |
+
h : float, default: 1
|
| 99 |
+
The hue, i.e. how saturated the colors are. If this parameter is zero
|
| 100 |
+
then the color scheme is purely a greyscale.
|
| 101 |
+
"""
|
| 102 |
+
return {'red': partial(_ch_helper, gamma, s, r, h, -0.14861, 1.78277),
|
| 103 |
+
'green': partial(_ch_helper, gamma, s, r, h, -0.29227, -0.90649),
|
| 104 |
+
'blue': partial(_ch_helper, gamma, s, r, h, 1.97294, 0.0)}
|
| 105 |
+
|
| 106 |
+
_cubehelix_data = cubehelix()
|
| 107 |
+
|
| 108 |
+
_bwr_data = ((0.0, 0.0, 1.0), (1.0, 1.0, 1.0), (1.0, 0.0, 0.0))
|
| 109 |
+
_brg_data = ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0))
|
| 110 |
+
|
| 111 |
+
# Gnuplot palette functions
|
| 112 |
+
def _g0(x): return 0
|
| 113 |
+
def _g1(x): return 0.5
|
| 114 |
+
def _g2(x): return 1
|
| 115 |
+
def _g3(x): return x
|
| 116 |
+
def _g4(x): return x ** 2
|
| 117 |
+
def _g5(x): return x ** 3
|
| 118 |
+
def _g6(x): return x ** 4
|
| 119 |
+
def _g7(x): return np.sqrt(x)
|
| 120 |
+
def _g8(x): return np.sqrt(np.sqrt(x))
|
| 121 |
+
def _g9(x): return np.sin(x * np.pi / 2)
|
| 122 |
+
def _g10(x): return np.cos(x * np.pi / 2)
|
| 123 |
+
def _g11(x): return np.abs(x - 0.5)
|
| 124 |
+
def _g12(x): return (2 * x - 1) ** 2
|
| 125 |
+
def _g13(x): return np.sin(x * np.pi)
|
| 126 |
+
def _g14(x): return np.abs(np.cos(x * np.pi))
|
| 127 |
+
def _g15(x): return np.sin(x * 2 * np.pi)
|
| 128 |
+
def _g16(x): return np.cos(x * 2 * np.pi)
|
| 129 |
+
def _g17(x): return np.abs(np.sin(x * 2 * np.pi))
|
| 130 |
+
def _g18(x): return np.abs(np.cos(x * 2 * np.pi))
|
| 131 |
+
def _g19(x): return np.abs(np.sin(x * 4 * np.pi))
|
| 132 |
+
def _g20(x): return np.abs(np.cos(x * 4 * np.pi))
|
| 133 |
+
def _g21(x): return 3 * x
|
| 134 |
+
def _g22(x): return 3 * x - 1
|
| 135 |
+
def _g23(x): return 3 * x - 2
|
| 136 |
+
def _g24(x): return np.abs(3 * x - 1)
|
| 137 |
+
def _g25(x): return np.abs(3 * x - 2)
|
| 138 |
+
def _g26(x): return (3 * x - 1) / 2
|
| 139 |
+
def _g27(x): return (3 * x - 2) / 2
|
| 140 |
+
def _g28(x): return np.abs((3 * x - 1) / 2)
|
| 141 |
+
def _g29(x): return np.abs((3 * x - 2) / 2)
|
| 142 |
+
def _g30(x): return x / 0.32 - 0.78125
|
| 143 |
+
def _g31(x): return 2 * x - 0.84
|
| 144 |
+
def _g32(x):
|
| 145 |
+
ret = np.zeros(len(x))
|
| 146 |
+
m = (x < 0.25)
|
| 147 |
+
ret[m] = 4 * x[m]
|
| 148 |
+
m = (x >= 0.25) & (x < 0.92)
|
| 149 |
+
ret[m] = -2 * x[m] + 1.84
|
| 150 |
+
m = (x >= 0.92)
|
| 151 |
+
ret[m] = x[m] / 0.08 - 11.5
|
| 152 |
+
return ret
|
| 153 |
+
def _g33(x): return np.abs(2 * x - 0.5)
|
| 154 |
+
def _g34(x): return 2 * x
|
| 155 |
+
def _g35(x): return 2 * x - 0.5
|
| 156 |
+
def _g36(x): return 2 * x - 1
|
| 157 |
+
|
| 158 |
+
gfunc = {i: globals()[f"_g{i}"] for i in range(37)}
|
| 159 |
+
|
| 160 |
+
_gnuplot_data = {
|
| 161 |
+
'red': gfunc[7],
|
| 162 |
+
'green': gfunc[5],
|
| 163 |
+
'blue': gfunc[15],
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
_gnuplot2_data = {
|
| 167 |
+
'red': gfunc[30],
|
| 168 |
+
'green': gfunc[31],
|
| 169 |
+
'blue': gfunc[32],
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
_ocean_data = {
|
| 173 |
+
'red': gfunc[23],
|
| 174 |
+
'green': gfunc[28],
|
| 175 |
+
'blue': gfunc[3],
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
_afmhot_data = {
|
| 179 |
+
'red': gfunc[34],
|
| 180 |
+
'green': gfunc[35],
|
| 181 |
+
'blue': gfunc[36],
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
_rainbow_data = {
|
| 185 |
+
'red': gfunc[33],
|
| 186 |
+
'green': gfunc[13],
|
| 187 |
+
'blue': gfunc[10],
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
_seismic_data = (
|
| 191 |
+
(0.0, 0.0, 0.3), (0.0, 0.0, 1.0),
|
| 192 |
+
(1.0, 1.0, 1.0), (1.0, 0.0, 0.0),
|
| 193 |
+
(0.5, 0.0, 0.0))
|
| 194 |
+
|
| 195 |
+
_terrain_data = (
|
| 196 |
+
(0.00, (0.2, 0.2, 0.6)),
|
| 197 |
+
(0.15, (0.0, 0.6, 1.0)),
|
| 198 |
+
(0.25, (0.0, 0.8, 0.4)),
|
| 199 |
+
(0.50, (1.0, 1.0, 0.6)),
|
| 200 |
+
(0.75, (0.5, 0.36, 0.33)),
|
| 201 |
+
(1.00, (1.0, 1.0, 1.0)))
|
| 202 |
+
|
| 203 |
+
_gray_data = {'red': ((0., 0, 0), (1., 1, 1)),
|
| 204 |
+
'green': ((0., 0, 0), (1., 1, 1)),
|
| 205 |
+
'blue': ((0., 0, 0), (1., 1, 1))}
|
| 206 |
+
|
| 207 |
+
_hot_data = {'red': ((0., 0.0416, 0.0416),
|
| 208 |
+
(0.365079, 1.000000, 1.000000),
|
| 209 |
+
(1.0, 1.0, 1.0)),
|
| 210 |
+
'green': ((0., 0., 0.),
|
| 211 |
+
(0.365079, 0.000000, 0.000000),
|
| 212 |
+
(0.746032, 1.000000, 1.000000),
|
| 213 |
+
(1.0, 1.0, 1.0)),
|
| 214 |
+
'blue': ((0., 0., 0.),
|
| 215 |
+
(0.746032, 0.000000, 0.000000),
|
| 216 |
+
(1.0, 1.0, 1.0))}
|
| 217 |
+
|
| 218 |
+
_hsv_data = {'red': ((0., 1., 1.),
|
| 219 |
+
(0.158730, 1.000000, 1.000000),
|
| 220 |
+
(0.174603, 0.968750, 0.968750),
|
| 221 |
+
(0.333333, 0.031250, 0.031250),
|
| 222 |
+
(0.349206, 0.000000, 0.000000),
|
| 223 |
+
(0.666667, 0.000000, 0.000000),
|
| 224 |
+
(0.682540, 0.031250, 0.031250),
|
| 225 |
+
(0.841270, 0.968750, 0.968750),
|
| 226 |
+
(0.857143, 1.000000, 1.000000),
|
| 227 |
+
(1.0, 1.0, 1.0)),
|
| 228 |
+
'green': ((0., 0., 0.),
|
| 229 |
+
(0.158730, 0.937500, 0.937500),
|
| 230 |
+
(0.174603, 1.000000, 1.000000),
|
| 231 |
+
(0.507937, 1.000000, 1.000000),
|
| 232 |
+
(0.666667, 0.062500, 0.062500),
|
| 233 |
+
(0.682540, 0.000000, 0.000000),
|
| 234 |
+
(1.0, 0., 0.)),
|
| 235 |
+
'blue': ((0., 0., 0.),
|
| 236 |
+
(0.333333, 0.000000, 0.000000),
|
| 237 |
+
(0.349206, 0.062500, 0.062500),
|
| 238 |
+
(0.507937, 1.000000, 1.000000),
|
| 239 |
+
(0.841270, 1.000000, 1.000000),
|
| 240 |
+
(0.857143, 0.937500, 0.937500),
|
| 241 |
+
(1.0, 0.09375, 0.09375))}
|
| 242 |
+
|
| 243 |
+
_jet_data = {'red': ((0.00, 0, 0),
|
| 244 |
+
(0.35, 0, 0),
|
| 245 |
+
(0.66, 1, 1),
|
| 246 |
+
(0.89, 1, 1),
|
| 247 |
+
(1.00, 0.5, 0.5)),
|
| 248 |
+
'green': ((0.000, 0, 0),
|
| 249 |
+
(0.125, 0, 0),
|
| 250 |
+
(0.375, 1, 1),
|
| 251 |
+
(0.640, 1, 1),
|
| 252 |
+
(0.910, 0, 0),
|
| 253 |
+
(1.000, 0, 0)),
|
| 254 |
+
'blue': ((0.00, 0.5, 0.5),
|
| 255 |
+
(0.11, 1, 1),
|
| 256 |
+
(0.34, 1, 1),
|
| 257 |
+
(0.65, 0, 0),
|
| 258 |
+
(1.00, 0, 0))}
|
| 259 |
+
|
| 260 |
+
_pink_data = {'red': ((0., 0.1178, 0.1178), (0.015873, 0.195857, 0.195857),
|
| 261 |
+
(0.031746, 0.250661, 0.250661),
|
| 262 |
+
(0.047619, 0.295468, 0.295468),
|
| 263 |
+
(0.063492, 0.334324, 0.334324),
|
| 264 |
+
(0.079365, 0.369112, 0.369112),
|
| 265 |
+
(0.095238, 0.400892, 0.400892),
|
| 266 |
+
(0.111111, 0.430331, 0.430331),
|
| 267 |
+
(0.126984, 0.457882, 0.457882),
|
| 268 |
+
(0.142857, 0.483867, 0.483867),
|
| 269 |
+
(0.158730, 0.508525, 0.508525),
|
| 270 |
+
(0.174603, 0.532042, 0.532042),
|
| 271 |
+
(0.190476, 0.554563, 0.554563),
|
| 272 |
+
(0.206349, 0.576204, 0.576204),
|
| 273 |
+
(0.222222, 0.597061, 0.597061),
|
| 274 |
+
(0.238095, 0.617213, 0.617213),
|
| 275 |
+
(0.253968, 0.636729, 0.636729),
|
| 276 |
+
(0.269841, 0.655663, 0.655663),
|
| 277 |
+
(0.285714, 0.674066, 0.674066),
|
| 278 |
+
(0.301587, 0.691980, 0.691980),
|
| 279 |
+
(0.317460, 0.709441, 0.709441),
|
| 280 |
+
(0.333333, 0.726483, 0.726483),
|
| 281 |
+
(0.349206, 0.743134, 0.743134),
|
| 282 |
+
(0.365079, 0.759421, 0.759421),
|
| 283 |
+
(0.380952, 0.766356, 0.766356),
|
| 284 |
+
(0.396825, 0.773229, 0.773229),
|
| 285 |
+
(0.412698, 0.780042, 0.780042),
|
| 286 |
+
(0.428571, 0.786796, 0.786796),
|
| 287 |
+
(0.444444, 0.793492, 0.793492),
|
| 288 |
+
(0.460317, 0.800132, 0.800132),
|
| 289 |
+
(0.476190, 0.806718, 0.806718),
|
| 290 |
+
(0.492063, 0.813250, 0.813250),
|
| 291 |
+
(0.507937, 0.819730, 0.819730),
|
| 292 |
+
(0.523810, 0.826160, 0.826160),
|
| 293 |
+
(0.539683, 0.832539, 0.832539),
|
| 294 |
+
(0.555556, 0.838870, 0.838870),
|
| 295 |
+
(0.571429, 0.845154, 0.845154),
|
| 296 |
+
(0.587302, 0.851392, 0.851392),
|
| 297 |
+
(0.603175, 0.857584, 0.857584),
|
| 298 |
+
(0.619048, 0.863731, 0.863731),
|
| 299 |
+
(0.634921, 0.869835, 0.869835),
|
| 300 |
+
(0.650794, 0.875897, 0.875897),
|
| 301 |
+
(0.666667, 0.881917, 0.881917),
|
| 302 |
+
(0.682540, 0.887896, 0.887896),
|
| 303 |
+
(0.698413, 0.893835, 0.893835),
|
| 304 |
+
(0.714286, 0.899735, 0.899735),
|
| 305 |
+
(0.730159, 0.905597, 0.905597),
|
| 306 |
+
(0.746032, 0.911421, 0.911421),
|
| 307 |
+
(0.761905, 0.917208, 0.917208),
|
| 308 |
+
(0.777778, 0.922958, 0.922958),
|
| 309 |
+
(0.793651, 0.928673, 0.928673),
|
| 310 |
+
(0.809524, 0.934353, 0.934353),
|
| 311 |
+
(0.825397, 0.939999, 0.939999),
|
| 312 |
+
(0.841270, 0.945611, 0.945611),
|
| 313 |
+
(0.857143, 0.951190, 0.951190),
|
| 314 |
+
(0.873016, 0.956736, 0.956736),
|
| 315 |
+
(0.888889, 0.962250, 0.962250),
|
| 316 |
+
(0.904762, 0.967733, 0.967733),
|
| 317 |
+
(0.920635, 0.973185, 0.973185),
|
| 318 |
+
(0.936508, 0.978607, 0.978607),
|
| 319 |
+
(0.952381, 0.983999, 0.983999),
|
| 320 |
+
(0.968254, 0.989361, 0.989361),
|
| 321 |
+
(0.984127, 0.994695, 0.994695), (1.0, 1.0, 1.0)),
|
| 322 |
+
'green': ((0., 0., 0.), (0.015873, 0.102869, 0.102869),
|
| 323 |
+
(0.031746, 0.145479, 0.145479),
|
| 324 |
+
(0.047619, 0.178174, 0.178174),
|
| 325 |
+
(0.063492, 0.205738, 0.205738),
|
| 326 |
+
(0.079365, 0.230022, 0.230022),
|
| 327 |
+
(0.095238, 0.251976, 0.251976),
|
| 328 |
+
(0.111111, 0.272166, 0.272166),
|
| 329 |
+
(0.126984, 0.290957, 0.290957),
|
| 330 |
+
(0.142857, 0.308607, 0.308607),
|
| 331 |
+
(0.158730, 0.325300, 0.325300),
|
| 332 |
+
(0.174603, 0.341178, 0.341178),
|
| 333 |
+
(0.190476, 0.356348, 0.356348),
|
| 334 |
+
(0.206349, 0.370899, 0.370899),
|
| 335 |
+
(0.222222, 0.384900, 0.384900),
|
| 336 |
+
(0.238095, 0.398410, 0.398410),
|
| 337 |
+
(0.253968, 0.411476, 0.411476),
|
| 338 |
+
(0.269841, 0.424139, 0.424139),
|
| 339 |
+
(0.285714, 0.436436, 0.436436),
|
| 340 |
+
(0.301587, 0.448395, 0.448395),
|
| 341 |
+
(0.317460, 0.460044, 0.460044),
|
| 342 |
+
(0.333333, 0.471405, 0.471405),
|
| 343 |
+
(0.349206, 0.482498, 0.482498),
|
| 344 |
+
(0.365079, 0.493342, 0.493342),
|
| 345 |
+
(0.380952, 0.517549, 0.517549),
|
| 346 |
+
(0.396825, 0.540674, 0.540674),
|
| 347 |
+
(0.412698, 0.562849, 0.562849),
|
| 348 |
+
(0.428571, 0.584183, 0.584183),
|
| 349 |
+
(0.444444, 0.604765, 0.604765),
|
| 350 |
+
(0.460317, 0.624669, 0.624669),
|
| 351 |
+
(0.476190, 0.643958, 0.643958),
|
| 352 |
+
(0.492063, 0.662687, 0.662687),
|
| 353 |
+
(0.507937, 0.680900, 0.680900),
|
| 354 |
+
(0.523810, 0.698638, 0.698638),
|
| 355 |
+
(0.539683, 0.715937, 0.715937),
|
| 356 |
+
(0.555556, 0.732828, 0.732828),
|
| 357 |
+
(0.571429, 0.749338, 0.749338),
|
| 358 |
+
(0.587302, 0.765493, 0.765493),
|
| 359 |
+
(0.603175, 0.781313, 0.781313),
|
| 360 |
+
(0.619048, 0.796819, 0.796819),
|
| 361 |
+
(0.634921, 0.812029, 0.812029),
|
| 362 |
+
(0.650794, 0.826960, 0.826960),
|
| 363 |
+
(0.666667, 0.841625, 0.841625),
|
| 364 |
+
(0.682540, 0.856040, 0.856040),
|
| 365 |
+
(0.698413, 0.870216, 0.870216),
|
| 366 |
+
(0.714286, 0.884164, 0.884164),
|
| 367 |
+
(0.730159, 0.897896, 0.897896),
|
| 368 |
+
(0.746032, 0.911421, 0.911421),
|
| 369 |
+
(0.761905, 0.917208, 0.917208),
|
| 370 |
+
(0.777778, 0.922958, 0.922958),
|
| 371 |
+
(0.793651, 0.928673, 0.928673),
|
| 372 |
+
(0.809524, 0.934353, 0.934353),
|
| 373 |
+
(0.825397, 0.939999, 0.939999),
|
| 374 |
+
(0.841270, 0.945611, 0.945611),
|
| 375 |
+
(0.857143, 0.951190, 0.951190),
|
| 376 |
+
(0.873016, 0.956736, 0.956736),
|
| 377 |
+
(0.888889, 0.962250, 0.962250),
|
| 378 |
+
(0.904762, 0.967733, 0.967733),
|
| 379 |
+
(0.920635, 0.973185, 0.973185),
|
| 380 |
+
(0.936508, 0.978607, 0.978607),
|
| 381 |
+
(0.952381, 0.983999, 0.983999),
|
| 382 |
+
(0.968254, 0.989361, 0.989361),
|
| 383 |
+
(0.984127, 0.994695, 0.994695), (1.0, 1.0, 1.0)),
|
| 384 |
+
'blue': ((0., 0., 0.), (0.015873, 0.102869, 0.102869),
|
| 385 |
+
(0.031746, 0.145479, 0.145479),
|
| 386 |
+
(0.047619, 0.178174, 0.178174),
|
| 387 |
+
(0.063492, 0.205738, 0.205738),
|
| 388 |
+
(0.079365, 0.230022, 0.230022),
|
| 389 |
+
(0.095238, 0.251976, 0.251976),
|
| 390 |
+
(0.111111, 0.272166, 0.272166),
|
| 391 |
+
(0.126984, 0.290957, 0.290957),
|
| 392 |
+
(0.142857, 0.308607, 0.308607),
|
| 393 |
+
(0.158730, 0.325300, 0.325300),
|
| 394 |
+
(0.174603, 0.341178, 0.341178),
|
| 395 |
+
(0.190476, 0.356348, 0.356348),
|
| 396 |
+
(0.206349, 0.370899, 0.370899),
|
| 397 |
+
(0.222222, 0.384900, 0.384900),
|
| 398 |
+
(0.238095, 0.398410, 0.398410),
|
| 399 |
+
(0.253968, 0.411476, 0.411476),
|
| 400 |
+
(0.269841, 0.424139, 0.424139),
|
| 401 |
+
(0.285714, 0.436436, 0.436436),
|
| 402 |
+
(0.301587, 0.448395, 0.448395),
|
| 403 |
+
(0.317460, 0.460044, 0.460044),
|
| 404 |
+
(0.333333, 0.471405, 0.471405),
|
| 405 |
+
(0.349206, 0.482498, 0.482498),
|
| 406 |
+
(0.365079, 0.493342, 0.493342),
|
| 407 |
+
(0.380952, 0.503953, 0.503953),
|
| 408 |
+
(0.396825, 0.514344, 0.514344),
|
| 409 |
+
(0.412698, 0.524531, 0.524531),
|
| 410 |
+
(0.428571, 0.534522, 0.534522),
|
| 411 |
+
(0.444444, 0.544331, 0.544331),
|
| 412 |
+
(0.460317, 0.553966, 0.553966),
|
| 413 |
+
(0.476190, 0.563436, 0.563436),
|
| 414 |
+
(0.492063, 0.572750, 0.572750),
|
| 415 |
+
(0.507937, 0.581914, 0.581914),
|
| 416 |
+
(0.523810, 0.590937, 0.590937),
|
| 417 |
+
(0.539683, 0.599824, 0.599824),
|
| 418 |
+
(0.555556, 0.608581, 0.608581),
|
| 419 |
+
(0.571429, 0.617213, 0.617213),
|
| 420 |
+
(0.587302, 0.625727, 0.625727),
|
| 421 |
+
(0.603175, 0.634126, 0.634126),
|
| 422 |
+
(0.619048, 0.642416, 0.642416),
|
| 423 |
+
(0.634921, 0.650600, 0.650600),
|
| 424 |
+
(0.650794, 0.658682, 0.658682),
|
| 425 |
+
(0.666667, 0.666667, 0.666667),
|
| 426 |
+
(0.682540, 0.674556, 0.674556),
|
| 427 |
+
(0.698413, 0.682355, 0.682355),
|
| 428 |
+
(0.714286, 0.690066, 0.690066),
|
| 429 |
+
(0.730159, 0.697691, 0.697691),
|
| 430 |
+
(0.746032, 0.705234, 0.705234),
|
| 431 |
+
(0.761905, 0.727166, 0.727166),
|
| 432 |
+
(0.777778, 0.748455, 0.748455),
|
| 433 |
+
(0.793651, 0.769156, 0.769156),
|
| 434 |
+
(0.809524, 0.789314, 0.789314),
|
| 435 |
+
(0.825397, 0.808969, 0.808969),
|
| 436 |
+
(0.841270, 0.828159, 0.828159),
|
| 437 |
+
(0.857143, 0.846913, 0.846913),
|
| 438 |
+
(0.873016, 0.865261, 0.865261),
|
| 439 |
+
(0.888889, 0.883229, 0.883229),
|
| 440 |
+
(0.904762, 0.900837, 0.900837),
|
| 441 |
+
(0.920635, 0.918109, 0.918109),
|
| 442 |
+
(0.936508, 0.935061, 0.935061),
|
| 443 |
+
(0.952381, 0.951711, 0.951711),
|
| 444 |
+
(0.968254, 0.968075, 0.968075),
|
| 445 |
+
(0.984127, 0.984167, 0.984167), (1.0, 1.0, 1.0))}
|
| 446 |
+
|
| 447 |
+
_spring_data = {'red': ((0., 1., 1.), (1.0, 1.0, 1.0)),
|
| 448 |
+
'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
|
| 449 |
+
'blue': ((0., 1., 1.), (1.0, 0.0, 0.0))}
|
| 450 |
+
|
| 451 |
+
|
| 452 |
+
_summer_data = {'red': ((0., 0., 0.), (1.0, 1.0, 1.0)),
|
| 453 |
+
'green': ((0., 0.5, 0.5), (1.0, 1.0, 1.0)),
|
| 454 |
+
'blue': ((0., 0.4, 0.4), (1.0, 0.4, 0.4))}
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
_winter_data = {'red': ((0., 0., 0.), (1.0, 0.0, 0.0)),
|
| 458 |
+
'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
|
| 459 |
+
'blue': ((0., 1., 1.), (1.0, 0.5, 0.5))}
|
| 460 |
+
|
| 461 |
+
_nipy_spectral_data = {
|
| 462 |
+
'red': [
|
| 463 |
+
(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667),
|
| 464 |
+
(0.10, 0.5333, 0.5333), (0.15, 0.0, 0.0),
|
| 465 |
+
(0.20, 0.0, 0.0), (0.25, 0.0, 0.0),
|
| 466 |
+
(0.30, 0.0, 0.0), (0.35, 0.0, 0.0),
|
| 467 |
+
(0.40, 0.0, 0.0), (0.45, 0.0, 0.0),
|
| 468 |
+
(0.50, 0.0, 0.0), (0.55, 0.0, 0.0),
|
| 469 |
+
(0.60, 0.0, 0.0), (0.65, 0.7333, 0.7333),
|
| 470 |
+
(0.70, 0.9333, 0.9333), (0.75, 1.0, 1.0),
|
| 471 |
+
(0.80, 1.0, 1.0), (0.85, 1.0, 1.0),
|
| 472 |
+
(0.90, 0.8667, 0.8667), (0.95, 0.80, 0.80),
|
| 473 |
+
(1.0, 0.80, 0.80),
|
| 474 |
+
],
|
| 475 |
+
'green': [
|
| 476 |
+
(0.0, 0.0, 0.0), (0.05, 0.0, 0.0),
|
| 477 |
+
(0.10, 0.0, 0.0), (0.15, 0.0, 0.0),
|
| 478 |
+
(0.20, 0.0, 0.0), (0.25, 0.4667, 0.4667),
|
| 479 |
+
(0.30, 0.6000, 0.6000), (0.35, 0.6667, 0.6667),
|
| 480 |
+
(0.40, 0.6667, 0.6667), (0.45, 0.6000, 0.6000),
|
| 481 |
+
(0.50, 0.7333, 0.7333), (0.55, 0.8667, 0.8667),
|
| 482 |
+
(0.60, 1.0, 1.0), (0.65, 1.0, 1.0),
|
| 483 |
+
(0.70, 0.9333, 0.9333), (0.75, 0.8000, 0.8000),
|
| 484 |
+
(0.80, 0.6000, 0.6000), (0.85, 0.0, 0.0),
|
| 485 |
+
(0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
|
| 486 |
+
(1.0, 0.80, 0.80),
|
| 487 |
+
],
|
| 488 |
+
'blue': [
|
| 489 |
+
(0.0, 0.0, 0.0), (0.05, 0.5333, 0.5333),
|
| 490 |
+
(0.10, 0.6000, 0.6000), (0.15, 0.6667, 0.6667),
|
| 491 |
+
(0.20, 0.8667, 0.8667), (0.25, 0.8667, 0.8667),
|
| 492 |
+
(0.30, 0.8667, 0.8667), (0.35, 0.6667, 0.6667),
|
| 493 |
+
(0.40, 0.5333, 0.5333), (0.45, 0.0, 0.0),
|
| 494 |
+
(0.5, 0.0, 0.0), (0.55, 0.0, 0.0),
|
| 495 |
+
(0.60, 0.0, 0.0), (0.65, 0.0, 0.0),
|
| 496 |
+
(0.70, 0.0, 0.0), (0.75, 0.0, 0.0),
|
| 497 |
+
(0.80, 0.0, 0.0), (0.85, 0.0, 0.0),
|
| 498 |
+
(0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
|
| 499 |
+
(1.0, 0.80, 0.80),
|
| 500 |
+
],
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
# 34 colormaps based on color specifications and designs
|
| 505 |
+
# developed by Cynthia Brewer (https://colorbrewer2.org/).
|
| 506 |
+
# The ColorBrewer palettes have been included under the terms
|
| 507 |
+
# of an Apache-stype license (for details, see the file
|
| 508 |
+
# LICENSE_COLORBREWER in the license directory of the matplotlib
|
| 509 |
+
# source distribution).
|
| 510 |
+
|
| 511 |
+
# RGB values taken from Brewer's Excel sheet, divided by 255
|
| 512 |
+
|
| 513 |
+
_Blues_data = (
|
| 514 |
+
(0.96862745098039216, 0.98431372549019602, 1.0 ),
|
| 515 |
+
(0.87058823529411766, 0.92156862745098034, 0.96862745098039216),
|
| 516 |
+
(0.77647058823529413, 0.85882352941176465, 0.93725490196078431),
|
| 517 |
+
(0.61960784313725492, 0.792156862745098 , 0.88235294117647056),
|
| 518 |
+
(0.41960784313725491, 0.68235294117647061, 0.83921568627450982),
|
| 519 |
+
(0.25882352941176473, 0.5725490196078431 , 0.77647058823529413),
|
| 520 |
+
(0.12941176470588237, 0.44313725490196076, 0.70980392156862748),
|
| 521 |
+
(0.03137254901960784, 0.31764705882352939, 0.61176470588235299),
|
| 522 |
+
(0.03137254901960784, 0.18823529411764706, 0.41960784313725491)
|
| 523 |
+
)
|
| 524 |
+
|
| 525 |
+
_BrBG_data = (
|
| 526 |
+
(0.32941176470588235, 0.18823529411764706, 0.0196078431372549 ),
|
| 527 |
+
(0.5490196078431373 , 0.31764705882352939, 0.0392156862745098 ),
|
| 528 |
+
(0.74901960784313726, 0.50588235294117645, 0.17647058823529413),
|
| 529 |
+
(0.87450980392156863, 0.76078431372549016, 0.49019607843137253),
|
| 530 |
+
(0.96470588235294119, 0.90980392156862744, 0.76470588235294112),
|
| 531 |
+
(0.96078431372549022, 0.96078431372549022, 0.96078431372549022),
|
| 532 |
+
(0.7803921568627451 , 0.91764705882352937, 0.89803921568627454),
|
| 533 |
+
(0.50196078431372548, 0.80392156862745101, 0.75686274509803919),
|
| 534 |
+
(0.20784313725490197, 0.59215686274509804, 0.5607843137254902 ),
|
| 535 |
+
(0.00392156862745098, 0.4 , 0.36862745098039218),
|
| 536 |
+
(0.0 , 0.23529411764705882, 0.18823529411764706)
|
| 537 |
+
)
|
| 538 |
+
|
| 539 |
+
_BuGn_data = (
|
| 540 |
+
(0.96862745098039216, 0.9882352941176471 , 0.99215686274509807),
|
| 541 |
+
(0.89803921568627454, 0.96078431372549022, 0.97647058823529409),
|
| 542 |
+
(0.8 , 0.92549019607843142, 0.90196078431372551),
|
| 543 |
+
(0.6 , 0.84705882352941175, 0.78823529411764703),
|
| 544 |
+
(0.4 , 0.76078431372549016, 0.64313725490196083),
|
| 545 |
+
(0.25490196078431371, 0.68235294117647061, 0.46274509803921571),
|
| 546 |
+
(0.13725490196078433, 0.54509803921568623, 0.27058823529411763),
|
| 547 |
+
(0.0 , 0.42745098039215684, 0.17254901960784313),
|
| 548 |
+
(0.0 , 0.26666666666666666, 0.10588235294117647)
|
| 549 |
+
)
|
| 550 |
+
|
| 551 |
+
_BuPu_data = (
|
| 552 |
+
(0.96862745098039216, 0.9882352941176471 , 0.99215686274509807),
|
| 553 |
+
(0.8784313725490196 , 0.92549019607843142, 0.95686274509803926),
|
| 554 |
+
(0.74901960784313726, 0.82745098039215681, 0.90196078431372551),
|
| 555 |
+
(0.61960784313725492, 0.73725490196078436, 0.85490196078431369),
|
| 556 |
+
(0.5490196078431373 , 0.58823529411764708, 0.77647058823529413),
|
| 557 |
+
(0.5490196078431373 , 0.41960784313725491, 0.69411764705882351),
|
| 558 |
+
(0.53333333333333333, 0.25490196078431371, 0.61568627450980395),
|
| 559 |
+
(0.50588235294117645, 0.05882352941176471, 0.48627450980392156),
|
| 560 |
+
(0.30196078431372547, 0.0 , 0.29411764705882354)
|
| 561 |
+
)
|
| 562 |
+
|
| 563 |
+
_GnBu_data = (
|
| 564 |
+
(0.96862745098039216, 0.9882352941176471 , 0.94117647058823528),
|
| 565 |
+
(0.8784313725490196 , 0.95294117647058818, 0.85882352941176465),
|
| 566 |
+
(0.8 , 0.92156862745098034, 0.77254901960784317),
|
| 567 |
+
(0.6588235294117647 , 0.8666666666666667 , 0.70980392156862748),
|
| 568 |
+
(0.4823529411764706 , 0.8 , 0.7686274509803922 ),
|
| 569 |
+
(0.30588235294117649, 0.70196078431372544, 0.82745098039215681),
|
| 570 |
+
(0.16862745098039217, 0.5490196078431373 , 0.74509803921568629),
|
| 571 |
+
(0.03137254901960784, 0.40784313725490196, 0.67450980392156867),
|
| 572 |
+
(0.03137254901960784, 0.25098039215686274, 0.50588235294117645)
|
| 573 |
+
)
|
| 574 |
+
|
| 575 |
+
_Greens_data = (
|
| 576 |
+
(0.96862745098039216, 0.9882352941176471 , 0.96078431372549022),
|
| 577 |
+
(0.89803921568627454, 0.96078431372549022, 0.8784313725490196 ),
|
| 578 |
+
(0.7803921568627451 , 0.9137254901960784 , 0.75294117647058822),
|
| 579 |
+
(0.63137254901960782, 0.85098039215686272, 0.60784313725490191),
|
| 580 |
+
(0.45490196078431372, 0.7686274509803922 , 0.46274509803921571),
|
| 581 |
+
(0.25490196078431371, 0.6705882352941176 , 0.36470588235294116),
|
| 582 |
+
(0.13725490196078433, 0.54509803921568623, 0.27058823529411763),
|
| 583 |
+
(0.0 , 0.42745098039215684, 0.17254901960784313),
|
| 584 |
+
(0.0 , 0.26666666666666666, 0.10588235294117647)
|
| 585 |
+
)
|
| 586 |
+
|
| 587 |
+
_Greys_data = (
|
| 588 |
+
(1.0 , 1.0 , 1.0 ),
|
| 589 |
+
(0.94117647058823528, 0.94117647058823528, 0.94117647058823528),
|
| 590 |
+
(0.85098039215686272, 0.85098039215686272, 0.85098039215686272),
|
| 591 |
+
(0.74117647058823533, 0.74117647058823533, 0.74117647058823533),
|
| 592 |
+
(0.58823529411764708, 0.58823529411764708, 0.58823529411764708),
|
| 593 |
+
(0.45098039215686275, 0.45098039215686275, 0.45098039215686275),
|
| 594 |
+
(0.32156862745098042, 0.32156862745098042, 0.32156862745098042),
|
| 595 |
+
(0.14509803921568629, 0.14509803921568629, 0.14509803921568629),
|
| 596 |
+
(0.0 , 0.0 , 0.0 )
|
| 597 |
+
)
|
| 598 |
+
|
| 599 |
+
_Oranges_data = (
|
| 600 |
+
(1.0 , 0.96078431372549022, 0.92156862745098034),
|
| 601 |
+
(0.99607843137254903, 0.90196078431372551, 0.80784313725490198),
|
| 602 |
+
(0.99215686274509807, 0.81568627450980391, 0.63529411764705879),
|
| 603 |
+
(0.99215686274509807, 0.68235294117647061, 0.41960784313725491),
|
| 604 |
+
(0.99215686274509807, 0.55294117647058827, 0.23529411764705882),
|
| 605 |
+
(0.94509803921568625, 0.41176470588235292, 0.07450980392156863),
|
| 606 |
+
(0.85098039215686272, 0.28235294117647058, 0.00392156862745098),
|
| 607 |
+
(0.65098039215686276, 0.21176470588235294, 0.01176470588235294),
|
| 608 |
+
(0.49803921568627452, 0.15294117647058825, 0.01568627450980392)
|
| 609 |
+
)
|
| 610 |
+
|
| 611 |
+
_OrRd_data = (
|
| 612 |
+
(1.0 , 0.96862745098039216, 0.92549019607843142),
|
| 613 |
+
(0.99607843137254903, 0.90980392156862744, 0.78431372549019607),
|
| 614 |
+
(0.99215686274509807, 0.83137254901960789, 0.61960784313725492),
|
| 615 |
+
(0.99215686274509807, 0.73333333333333328, 0.51764705882352946),
|
| 616 |
+
(0.9882352941176471 , 0.55294117647058827, 0.34901960784313724),
|
| 617 |
+
(0.93725490196078431, 0.396078431372549 , 0.28235294117647058),
|
| 618 |
+
(0.84313725490196079, 0.18823529411764706, 0.12156862745098039),
|
| 619 |
+
(0.70196078431372544, 0.0 , 0.0 ),
|
| 620 |
+
(0.49803921568627452, 0.0 , 0.0 )
|
| 621 |
+
)
|
| 622 |
+
|
| 623 |
+
_PiYG_data = (
|
| 624 |
+
(0.55686274509803924, 0.00392156862745098, 0.32156862745098042),
|
| 625 |
+
(0.77254901960784317, 0.10588235294117647, 0.49019607843137253),
|
| 626 |
+
(0.87058823529411766, 0.46666666666666667, 0.68235294117647061),
|
| 627 |
+
(0.94509803921568625, 0.71372549019607845, 0.85490196078431369),
|
| 628 |
+
(0.99215686274509807, 0.8784313725490196 , 0.93725490196078431),
|
| 629 |
+
(0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
|
| 630 |
+
(0.90196078431372551, 0.96078431372549022, 0.81568627450980391),
|
| 631 |
+
(0.72156862745098038, 0.88235294117647056, 0.52549019607843139),
|
| 632 |
+
(0.49803921568627452, 0.73725490196078436, 0.25490196078431371),
|
| 633 |
+
(0.30196078431372547, 0.5725490196078431 , 0.12941176470588237),
|
| 634 |
+
(0.15294117647058825, 0.39215686274509803, 0.09803921568627451)
|
| 635 |
+
)
|
| 636 |
+
|
| 637 |
+
_PRGn_data = (
|
| 638 |
+
(0.25098039215686274, 0.0 , 0.29411764705882354),
|
| 639 |
+
(0.46274509803921571, 0.16470588235294117, 0.51372549019607838),
|
| 640 |
+
(0.6 , 0.4392156862745098 , 0.6705882352941176 ),
|
| 641 |
+
(0.76078431372549016, 0.6470588235294118 , 0.81176470588235294),
|
| 642 |
+
(0.90588235294117647, 0.83137254901960789, 0.90980392156862744),
|
| 643 |
+
(0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
|
| 644 |
+
(0.85098039215686272, 0.94117647058823528, 0.82745098039215681),
|
| 645 |
+
(0.65098039215686276, 0.85882352941176465, 0.62745098039215685),
|
| 646 |
+
(0.35294117647058826, 0.68235294117647061, 0.38039215686274508),
|
| 647 |
+
(0.10588235294117647, 0.47058823529411764, 0.21568627450980393),
|
| 648 |
+
(0.0 , 0.26666666666666666, 0.10588235294117647)
|
| 649 |
+
)
|
| 650 |
+
|
| 651 |
+
_PuBu_data = (
|
| 652 |
+
(1.0 , 0.96862745098039216, 0.98431372549019602),
|
| 653 |
+
(0.92549019607843142, 0.90588235294117647, 0.94901960784313721),
|
| 654 |
+
(0.81568627450980391, 0.81960784313725488, 0.90196078431372551),
|
| 655 |
+
(0.65098039215686276, 0.74117647058823533, 0.85882352941176465),
|
| 656 |
+
(0.45490196078431372, 0.66274509803921566, 0.81176470588235294),
|
| 657 |
+
(0.21176470588235294, 0.56470588235294117, 0.75294117647058822),
|
| 658 |
+
(0.0196078431372549 , 0.4392156862745098 , 0.69019607843137254),
|
| 659 |
+
(0.01568627450980392, 0.35294117647058826, 0.55294117647058827),
|
| 660 |
+
(0.00784313725490196, 0.2196078431372549 , 0.34509803921568627)
|
| 661 |
+
)
|
| 662 |
+
|
| 663 |
+
_PuBuGn_data = (
|
| 664 |
+
(1.0 , 0.96862745098039216, 0.98431372549019602),
|
| 665 |
+
(0.92549019607843142, 0.88627450980392153, 0.94117647058823528),
|
| 666 |
+
(0.81568627450980391, 0.81960784313725488, 0.90196078431372551),
|
| 667 |
+
(0.65098039215686276, 0.74117647058823533, 0.85882352941176465),
|
| 668 |
+
(0.40392156862745099, 0.66274509803921566, 0.81176470588235294),
|
| 669 |
+
(0.21176470588235294, 0.56470588235294117, 0.75294117647058822),
|
| 670 |
+
(0.00784313725490196, 0.50588235294117645, 0.54117647058823526),
|
| 671 |
+
(0.00392156862745098, 0.42352941176470588, 0.34901960784313724),
|
| 672 |
+
(0.00392156862745098, 0.27450980392156865, 0.21176470588235294)
|
| 673 |
+
)
|
| 674 |
+
|
| 675 |
+
_PuOr_data = (
|
| 676 |
+
(0.49803921568627452, 0.23137254901960785, 0.03137254901960784),
|
| 677 |
+
(0.70196078431372544, 0.34509803921568627, 0.02352941176470588),
|
| 678 |
+
(0.8784313725490196 , 0.50980392156862742, 0.07843137254901961),
|
| 679 |
+
(0.99215686274509807, 0.72156862745098038, 0.38823529411764707),
|
| 680 |
+
(0.99607843137254903, 0.8784313725490196 , 0.71372549019607845),
|
| 681 |
+
(0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
|
| 682 |
+
(0.84705882352941175, 0.85490196078431369, 0.92156862745098034),
|
| 683 |
+
(0.69803921568627447, 0.6705882352941176 , 0.82352941176470584),
|
| 684 |
+
(0.50196078431372548, 0.45098039215686275, 0.67450980392156867),
|
| 685 |
+
(0.32941176470588235, 0.15294117647058825, 0.53333333333333333),
|
| 686 |
+
(0.17647058823529413, 0.0 , 0.29411764705882354)
|
| 687 |
+
)
|
| 688 |
+
|
| 689 |
+
_PuRd_data = (
|
| 690 |
+
(0.96862745098039216, 0.95686274509803926, 0.97647058823529409),
|
| 691 |
+
(0.90588235294117647, 0.88235294117647056, 0.93725490196078431),
|
| 692 |
+
(0.83137254901960789, 0.72549019607843135, 0.85490196078431369),
|
| 693 |
+
(0.78823529411764703, 0.58039215686274515, 0.7803921568627451 ),
|
| 694 |
+
(0.87450980392156863, 0.396078431372549 , 0.69019607843137254),
|
| 695 |
+
(0.90588235294117647, 0.16078431372549021, 0.54117647058823526),
|
| 696 |
+
(0.80784313725490198, 0.07058823529411765, 0.33725490196078434),
|
| 697 |
+
(0.59607843137254901, 0.0 , 0.2627450980392157 ),
|
| 698 |
+
(0.40392156862745099, 0.0 , 0.12156862745098039)
|
| 699 |
+
)
|
| 700 |
+
|
| 701 |
+
_Purples_data = (
|
| 702 |
+
(0.9882352941176471 , 0.98431372549019602, 0.99215686274509807),
|
| 703 |
+
(0.93725490196078431, 0.92941176470588238, 0.96078431372549022),
|
| 704 |
+
(0.85490196078431369, 0.85490196078431369, 0.92156862745098034),
|
| 705 |
+
(0.73725490196078436, 0.74117647058823533, 0.86274509803921573),
|
| 706 |
+
(0.61960784313725492, 0.60392156862745094, 0.78431372549019607),
|
| 707 |
+
(0.50196078431372548, 0.49019607843137253, 0.72941176470588232),
|
| 708 |
+
(0.41568627450980394, 0.31764705882352939, 0.63921568627450975),
|
| 709 |
+
(0.32941176470588235, 0.15294117647058825, 0.5607843137254902 ),
|
| 710 |
+
(0.24705882352941178, 0.0 , 0.49019607843137253)
|
| 711 |
+
)
|
| 712 |
+
|
| 713 |
+
_RdBu_data = (
|
| 714 |
+
(0.40392156862745099, 0.0 , 0.12156862745098039),
|
| 715 |
+
(0.69803921568627447, 0.09411764705882353, 0.16862745098039217),
|
| 716 |
+
(0.83921568627450982, 0.37647058823529411, 0.30196078431372547),
|
| 717 |
+
(0.95686274509803926, 0.6470588235294118 , 0.50980392156862742),
|
| 718 |
+
(0.99215686274509807, 0.85882352941176465, 0.7803921568627451 ),
|
| 719 |
+
(0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
|
| 720 |
+
(0.81960784313725488, 0.89803921568627454, 0.94117647058823528),
|
| 721 |
+
(0.5725490196078431 , 0.77254901960784317, 0.87058823529411766),
|
| 722 |
+
(0.2627450980392157 , 0.57647058823529407, 0.76470588235294112),
|
| 723 |
+
(0.12941176470588237, 0.4 , 0.67450980392156867),
|
| 724 |
+
(0.0196078431372549 , 0.18823529411764706, 0.38039215686274508)
|
| 725 |
+
)
|
| 726 |
+
|
| 727 |
+
_RdGy_data = (
|
| 728 |
+
(0.40392156862745099, 0.0 , 0.12156862745098039),
|
| 729 |
+
(0.69803921568627447, 0.09411764705882353, 0.16862745098039217),
|
| 730 |
+
(0.83921568627450982, 0.37647058823529411, 0.30196078431372547),
|
| 731 |
+
(0.95686274509803926, 0.6470588235294118 , 0.50980392156862742),
|
| 732 |
+
(0.99215686274509807, 0.85882352941176465, 0.7803921568627451 ),
|
| 733 |
+
(1.0 , 1.0 , 1.0 ),
|
| 734 |
+
(0.8784313725490196 , 0.8784313725490196 , 0.8784313725490196 ),
|
| 735 |
+
(0.72941176470588232, 0.72941176470588232, 0.72941176470588232),
|
| 736 |
+
(0.52941176470588236, 0.52941176470588236, 0.52941176470588236),
|
| 737 |
+
(0.30196078431372547, 0.30196078431372547, 0.30196078431372547),
|
| 738 |
+
(0.10196078431372549, 0.10196078431372549, 0.10196078431372549)
|
| 739 |
+
)
|
| 740 |
+
|
| 741 |
+
_RdPu_data = (
|
| 742 |
+
(1.0 , 0.96862745098039216, 0.95294117647058818),
|
| 743 |
+
(0.99215686274509807, 0.8784313725490196 , 0.86666666666666667),
|
| 744 |
+
(0.9882352941176471 , 0.77254901960784317, 0.75294117647058822),
|
| 745 |
+
(0.98039215686274506, 0.62352941176470589, 0.70980392156862748),
|
| 746 |
+
(0.96862745098039216, 0.40784313725490196, 0.63137254901960782),
|
| 747 |
+
(0.86666666666666667, 0.20392156862745098, 0.59215686274509804),
|
| 748 |
+
(0.68235294117647061, 0.00392156862745098, 0.49411764705882355),
|
| 749 |
+
(0.47843137254901963, 0.00392156862745098, 0.46666666666666667),
|
| 750 |
+
(0.28627450980392155, 0.0 , 0.41568627450980394)
|
| 751 |
+
)
|
| 752 |
+
|
| 753 |
+
_RdYlBu_data = (
|
| 754 |
+
(0.6470588235294118 , 0.0 , 0.14901960784313725),
|
| 755 |
+
(0.84313725490196079, 0.18823529411764706 , 0.15294117647058825),
|
| 756 |
+
(0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
|
| 757 |
+
(0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
|
| 758 |
+
(0.99607843137254903, 0.8784313725490196 , 0.56470588235294117),
|
| 759 |
+
(1.0 , 1.0 , 0.74901960784313726),
|
| 760 |
+
(0.8784313725490196 , 0.95294117647058818 , 0.97254901960784312),
|
| 761 |
+
(0.6705882352941176 , 0.85098039215686272 , 0.9137254901960784 ),
|
| 762 |
+
(0.45490196078431372, 0.67843137254901964 , 0.81960784313725488),
|
| 763 |
+
(0.27058823529411763, 0.45882352941176469 , 0.70588235294117652),
|
| 764 |
+
(0.19215686274509805, 0.21176470588235294 , 0.58431372549019611)
|
| 765 |
+
)
|
| 766 |
+
|
| 767 |
+
_RdYlGn_data = (
|
| 768 |
+
(0.6470588235294118 , 0.0 , 0.14901960784313725),
|
| 769 |
+
(0.84313725490196079, 0.18823529411764706 , 0.15294117647058825),
|
| 770 |
+
(0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
|
| 771 |
+
(0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
|
| 772 |
+
(0.99607843137254903, 0.8784313725490196 , 0.54509803921568623),
|
| 773 |
+
(1.0 , 1.0 , 0.74901960784313726),
|
| 774 |
+
(0.85098039215686272, 0.93725490196078431 , 0.54509803921568623),
|
| 775 |
+
(0.65098039215686276, 0.85098039215686272 , 0.41568627450980394),
|
| 776 |
+
(0.4 , 0.74117647058823533 , 0.38823529411764707),
|
| 777 |
+
(0.10196078431372549, 0.59607843137254901 , 0.31372549019607843),
|
| 778 |
+
(0.0 , 0.40784313725490196 , 0.21568627450980393)
|
| 779 |
+
)
|
| 780 |
+
|
| 781 |
+
_Reds_data = (
|
| 782 |
+
(1.0 , 0.96078431372549022 , 0.94117647058823528),
|
| 783 |
+
(0.99607843137254903, 0.8784313725490196 , 0.82352941176470584),
|
| 784 |
+
(0.9882352941176471 , 0.73333333333333328 , 0.63137254901960782),
|
| 785 |
+
(0.9882352941176471 , 0.5725490196078431 , 0.44705882352941179),
|
| 786 |
+
(0.98431372549019602, 0.41568627450980394 , 0.29019607843137257),
|
| 787 |
+
(0.93725490196078431, 0.23137254901960785 , 0.17254901960784313),
|
| 788 |
+
(0.79607843137254897, 0.094117647058823528, 0.11372549019607843),
|
| 789 |
+
(0.6470588235294118 , 0.058823529411764705, 0.08235294117647058),
|
| 790 |
+
(0.40392156862745099, 0.0 , 0.05098039215686274)
|
| 791 |
+
)
|
| 792 |
+
|
| 793 |
+
_Spectral_data = (
|
| 794 |
+
(0.61960784313725492, 0.003921568627450980, 0.25882352941176473),
|
| 795 |
+
(0.83529411764705885, 0.24313725490196078 , 0.30980392156862746),
|
| 796 |
+
(0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
|
| 797 |
+
(0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
|
| 798 |
+
(0.99607843137254903, 0.8784313725490196 , 0.54509803921568623),
|
| 799 |
+
(1.0 , 1.0 , 0.74901960784313726),
|
| 800 |
+
(0.90196078431372551, 0.96078431372549022 , 0.59607843137254901),
|
| 801 |
+
(0.6705882352941176 , 0.8666666666666667 , 0.64313725490196083),
|
| 802 |
+
(0.4 , 0.76078431372549016 , 0.6470588235294118 ),
|
| 803 |
+
(0.19607843137254902, 0.53333333333333333 , 0.74117647058823533),
|
| 804 |
+
(0.36862745098039218, 0.30980392156862746 , 0.63529411764705879)
|
| 805 |
+
)
|
| 806 |
+
|
| 807 |
+
_YlGn_data = (
|
| 808 |
+
(1.0 , 1.0 , 0.89803921568627454),
|
| 809 |
+
(0.96862745098039216, 0.9882352941176471 , 0.72549019607843135),
|
| 810 |
+
(0.85098039215686272, 0.94117647058823528 , 0.63921568627450975),
|
| 811 |
+
(0.67843137254901964, 0.8666666666666667 , 0.55686274509803924),
|
| 812 |
+
(0.47058823529411764, 0.77647058823529413 , 0.47450980392156861),
|
| 813 |
+
(0.25490196078431371, 0.6705882352941176 , 0.36470588235294116),
|
| 814 |
+
(0.13725490196078433, 0.51764705882352946 , 0.2627450980392157 ),
|
| 815 |
+
(0.0 , 0.40784313725490196 , 0.21568627450980393),
|
| 816 |
+
(0.0 , 0.27058823529411763 , 0.16078431372549021)
|
| 817 |
+
)
|
| 818 |
+
|
| 819 |
+
_YlGnBu_data = (
|
| 820 |
+
(1.0 , 1.0 , 0.85098039215686272),
|
| 821 |
+
(0.92941176470588238, 0.97254901960784312 , 0.69411764705882351),
|
| 822 |
+
(0.7803921568627451 , 0.9137254901960784 , 0.70588235294117652),
|
| 823 |
+
(0.49803921568627452, 0.80392156862745101 , 0.73333333333333328),
|
| 824 |
+
(0.25490196078431371, 0.71372549019607845 , 0.7686274509803922 ),
|
| 825 |
+
(0.11372549019607843, 0.56862745098039214 , 0.75294117647058822),
|
| 826 |
+
(0.13333333333333333, 0.36862745098039218 , 0.6588235294117647 ),
|
| 827 |
+
(0.14509803921568629, 0.20392156862745098 , 0.58039215686274515),
|
| 828 |
+
(0.03137254901960784, 0.11372549019607843 , 0.34509803921568627)
|
| 829 |
+
)
|
| 830 |
+
|
| 831 |
+
_YlOrBr_data = (
|
| 832 |
+
(1.0 , 1.0 , 0.89803921568627454),
|
| 833 |
+
(1.0 , 0.96862745098039216 , 0.73725490196078436),
|
| 834 |
+
(0.99607843137254903, 0.8901960784313725 , 0.56862745098039214),
|
| 835 |
+
(0.99607843137254903, 0.7686274509803922 , 0.30980392156862746),
|
| 836 |
+
(0.99607843137254903, 0.6 , 0.16078431372549021),
|
| 837 |
+
(0.92549019607843142, 0.4392156862745098 , 0.07843137254901961),
|
| 838 |
+
(0.8 , 0.29803921568627451 , 0.00784313725490196),
|
| 839 |
+
(0.6 , 0.20392156862745098 , 0.01568627450980392),
|
| 840 |
+
(0.4 , 0.14509803921568629 , 0.02352941176470588)
|
| 841 |
+
)
|
| 842 |
+
|
| 843 |
+
_YlOrRd_data = (
|
| 844 |
+
(1.0 , 1.0 , 0.8 ),
|
| 845 |
+
(1.0 , 0.92941176470588238 , 0.62745098039215685),
|
| 846 |
+
(0.99607843137254903, 0.85098039215686272 , 0.46274509803921571),
|
| 847 |
+
(0.99607843137254903, 0.69803921568627447 , 0.29803921568627451),
|
| 848 |
+
(0.99215686274509807, 0.55294117647058827 , 0.23529411764705882),
|
| 849 |
+
(0.9882352941176471 , 0.30588235294117649 , 0.16470588235294117),
|
| 850 |
+
(0.8901960784313725 , 0.10196078431372549 , 0.10980392156862745),
|
| 851 |
+
(0.74117647058823533, 0.0 , 0.14901960784313725),
|
| 852 |
+
(0.50196078431372548, 0.0 , 0.14901960784313725)
|
| 853 |
+
)
|
| 854 |
+
|
| 855 |
+
|
| 856 |
+
# ColorBrewer's qualitative maps, implemented using ListedColormap
|
| 857 |
+
# for use with mpl.colors.NoNorm
|
| 858 |
+
|
| 859 |
+
_Accent_data = (
|
| 860 |
+
(0.49803921568627452, 0.78823529411764703, 0.49803921568627452),
|
| 861 |
+
(0.74509803921568629, 0.68235294117647061, 0.83137254901960789),
|
| 862 |
+
(0.99215686274509807, 0.75294117647058822, 0.52549019607843139),
|
| 863 |
+
(1.0, 1.0, 0.6 ),
|
| 864 |
+
(0.2196078431372549, 0.42352941176470588, 0.69019607843137254),
|
| 865 |
+
(0.94117647058823528, 0.00784313725490196, 0.49803921568627452),
|
| 866 |
+
(0.74901960784313726, 0.35686274509803922, 0.09019607843137254),
|
| 867 |
+
(0.4, 0.4, 0.4 ),
|
| 868 |
+
)
|
| 869 |
+
|
| 870 |
+
_Dark2_data = (
|
| 871 |
+
(0.10588235294117647, 0.61960784313725492, 0.46666666666666667),
|
| 872 |
+
(0.85098039215686272, 0.37254901960784315, 0.00784313725490196),
|
| 873 |
+
(0.45882352941176469, 0.4392156862745098, 0.70196078431372544),
|
| 874 |
+
(0.90588235294117647, 0.16078431372549021, 0.54117647058823526),
|
| 875 |
+
(0.4, 0.65098039215686276, 0.11764705882352941),
|
| 876 |
+
(0.90196078431372551, 0.6705882352941176, 0.00784313725490196),
|
| 877 |
+
(0.65098039215686276, 0.46274509803921571, 0.11372549019607843),
|
| 878 |
+
(0.4, 0.4, 0.4 ),
|
| 879 |
+
)
|
| 880 |
+
|
| 881 |
+
_Paired_data = (
|
| 882 |
+
(0.65098039215686276, 0.80784313725490198, 0.8901960784313725 ),
|
| 883 |
+
(0.12156862745098039, 0.47058823529411764, 0.70588235294117652),
|
| 884 |
+
(0.69803921568627447, 0.87450980392156863, 0.54117647058823526),
|
| 885 |
+
(0.2, 0.62745098039215685, 0.17254901960784313),
|
| 886 |
+
(0.98431372549019602, 0.60392156862745094, 0.6 ),
|
| 887 |
+
(0.8901960784313725, 0.10196078431372549, 0.10980392156862745),
|
| 888 |
+
(0.99215686274509807, 0.74901960784313726, 0.43529411764705883),
|
| 889 |
+
(1.0, 0.49803921568627452, 0.0 ),
|
| 890 |
+
(0.792156862745098, 0.69803921568627447, 0.83921568627450982),
|
| 891 |
+
(0.41568627450980394, 0.23921568627450981, 0.60392156862745094),
|
| 892 |
+
(1.0, 1.0, 0.6 ),
|
| 893 |
+
(0.69411764705882351, 0.34901960784313724, 0.15686274509803921),
|
| 894 |
+
)
|
| 895 |
+
|
| 896 |
+
_Pastel1_data = (
|
| 897 |
+
(0.98431372549019602, 0.70588235294117652, 0.68235294117647061),
|
| 898 |
+
(0.70196078431372544, 0.80392156862745101, 0.8901960784313725 ),
|
| 899 |
+
(0.8, 0.92156862745098034, 0.77254901960784317),
|
| 900 |
+
(0.87058823529411766, 0.79607843137254897, 0.89411764705882357),
|
| 901 |
+
(0.99607843137254903, 0.85098039215686272, 0.65098039215686276),
|
| 902 |
+
(1.0, 1.0, 0.8 ),
|
| 903 |
+
(0.89803921568627454, 0.84705882352941175, 0.74117647058823533),
|
| 904 |
+
(0.99215686274509807, 0.85490196078431369, 0.92549019607843142),
|
| 905 |
+
(0.94901960784313721, 0.94901960784313721, 0.94901960784313721),
|
| 906 |
+
)
|
| 907 |
+
|
| 908 |
+
_Pastel2_data = (
|
| 909 |
+
(0.70196078431372544, 0.88627450980392153, 0.80392156862745101),
|
| 910 |
+
(0.99215686274509807, 0.80392156862745101, 0.67450980392156867),
|
| 911 |
+
(0.79607843137254897, 0.83529411764705885, 0.90980392156862744),
|
| 912 |
+
(0.95686274509803926, 0.792156862745098, 0.89411764705882357),
|
| 913 |
+
(0.90196078431372551, 0.96078431372549022, 0.78823529411764703),
|
| 914 |
+
(1.0, 0.94901960784313721, 0.68235294117647061),
|
| 915 |
+
(0.94509803921568625, 0.88627450980392153, 0.8 ),
|
| 916 |
+
(0.8, 0.8, 0.8 ),
|
| 917 |
+
)
|
| 918 |
+
|
| 919 |
+
_Set1_data = (
|
| 920 |
+
(0.89411764705882357, 0.10196078431372549, 0.10980392156862745),
|
| 921 |
+
(0.21568627450980393, 0.49411764705882355, 0.72156862745098038),
|
| 922 |
+
(0.30196078431372547, 0.68627450980392157, 0.29019607843137257),
|
| 923 |
+
(0.59607843137254901, 0.30588235294117649, 0.63921568627450975),
|
| 924 |
+
(1.0, 0.49803921568627452, 0.0 ),
|
| 925 |
+
(1.0, 1.0, 0.2 ),
|
| 926 |
+
(0.65098039215686276, 0.33725490196078434, 0.15686274509803921),
|
| 927 |
+
(0.96862745098039216, 0.50588235294117645, 0.74901960784313726),
|
| 928 |
+
(0.6, 0.6, 0.6),
|
| 929 |
+
)
|
| 930 |
+
|
| 931 |
+
_Set2_data = (
|
| 932 |
+
(0.4, 0.76078431372549016, 0.6470588235294118 ),
|
| 933 |
+
(0.9882352941176471, 0.55294117647058827, 0.3843137254901961 ),
|
| 934 |
+
(0.55294117647058827, 0.62745098039215685, 0.79607843137254897),
|
| 935 |
+
(0.90588235294117647, 0.54117647058823526, 0.76470588235294112),
|
| 936 |
+
(0.65098039215686276, 0.84705882352941175, 0.32941176470588235),
|
| 937 |
+
(1.0, 0.85098039215686272, 0.18431372549019609),
|
| 938 |
+
(0.89803921568627454, 0.7686274509803922, 0.58039215686274515),
|
| 939 |
+
(0.70196078431372544, 0.70196078431372544, 0.70196078431372544),
|
| 940 |
+
)
|
| 941 |
+
|
| 942 |
+
_Set3_data = (
|
| 943 |
+
(0.55294117647058827, 0.82745098039215681, 0.7803921568627451 ),
|
| 944 |
+
(1.0, 1.0, 0.70196078431372544),
|
| 945 |
+
(0.74509803921568629, 0.72941176470588232, 0.85490196078431369),
|
| 946 |
+
(0.98431372549019602, 0.50196078431372548, 0.44705882352941179),
|
| 947 |
+
(0.50196078431372548, 0.69411764705882351, 0.82745098039215681),
|
| 948 |
+
(0.99215686274509807, 0.70588235294117652, 0.3843137254901961 ),
|
| 949 |
+
(0.70196078431372544, 0.87058823529411766, 0.41176470588235292),
|
| 950 |
+
(0.9882352941176471, 0.80392156862745101, 0.89803921568627454),
|
| 951 |
+
(0.85098039215686272, 0.85098039215686272, 0.85098039215686272),
|
| 952 |
+
(0.73725490196078436, 0.50196078431372548, 0.74117647058823533),
|
| 953 |
+
(0.8, 0.92156862745098034, 0.77254901960784317),
|
| 954 |
+
(1.0, 0.92941176470588238, 0.43529411764705883),
|
| 955 |
+
)
|
| 956 |
+
|
| 957 |
+
|
| 958 |
+
# The next 7 palettes are from the Yorick scientific visualization package,
|
| 959 |
+
# an evolution of the GIST package, both by David H. Munro.
|
| 960 |
+
# They are released under a BSD-like license (see LICENSE_YORICK in
|
| 961 |
+
# the license directory of the matplotlib source distribution).
|
| 962 |
+
#
|
| 963 |
+
# Most palette functions have been reduced to simple function descriptions
|
| 964 |
+
# by Reinier Heeres, since the rgb components were mostly straight lines.
|
| 965 |
+
# gist_earth_data and gist_ncar_data were simplified by a script and some
|
| 966 |
+
# manual effort.
|
| 967 |
+
|
| 968 |
+
_gist_earth_data = {
|
| 969 |
+
'red': (
|
| 970 |
+
(0.0, 0.0, 0.0000),
|
| 971 |
+
(0.2824, 0.1882, 0.1882),
|
| 972 |
+
(0.4588, 0.2714, 0.2714),
|
| 973 |
+
(0.5490, 0.4719, 0.4719),
|
| 974 |
+
(0.6980, 0.7176, 0.7176),
|
| 975 |
+
(0.7882, 0.7553, 0.7553),
|
| 976 |
+
(1.0000, 0.9922, 0.9922),
|
| 977 |
+
),
|
| 978 |
+
'green': (
|
| 979 |
+
(0.0, 0.0, 0.0000),
|
| 980 |
+
(0.0275, 0.0000, 0.0000),
|
| 981 |
+
(0.1098, 0.1893, 0.1893),
|
| 982 |
+
(0.1647, 0.3035, 0.3035),
|
| 983 |
+
(0.2078, 0.3841, 0.3841),
|
| 984 |
+
(0.2824, 0.5020, 0.5020),
|
| 985 |
+
(0.5216, 0.6397, 0.6397),
|
| 986 |
+
(0.6980, 0.7171, 0.7171),
|
| 987 |
+
(0.7882, 0.6392, 0.6392),
|
| 988 |
+
(0.7922, 0.6413, 0.6413),
|
| 989 |
+
(0.8000, 0.6447, 0.6447),
|
| 990 |
+
(0.8078, 0.6481, 0.6481),
|
| 991 |
+
(0.8157, 0.6549, 0.6549),
|
| 992 |
+
(0.8667, 0.6991, 0.6991),
|
| 993 |
+
(0.8745, 0.7103, 0.7103),
|
| 994 |
+
(0.8824, 0.7216, 0.7216),
|
| 995 |
+
(0.8902, 0.7323, 0.7323),
|
| 996 |
+
(0.8980, 0.7430, 0.7430),
|
| 997 |
+
(0.9412, 0.8275, 0.8275),
|
| 998 |
+
(0.9569, 0.8635, 0.8635),
|
| 999 |
+
(0.9647, 0.8816, 0.8816),
|
| 1000 |
+
(0.9961, 0.9733, 0.9733),
|
| 1001 |
+
(1.0000, 0.9843, 0.9843),
|
| 1002 |
+
),
|
| 1003 |
+
'blue': (
|
| 1004 |
+
(0.0, 0.0, 0.0000),
|
| 1005 |
+
(0.0039, 0.1684, 0.1684),
|
| 1006 |
+
(0.0078, 0.2212, 0.2212),
|
| 1007 |
+
(0.0275, 0.4329, 0.4329),
|
| 1008 |
+
(0.0314, 0.4549, 0.4549),
|
| 1009 |
+
(0.2824, 0.5004, 0.5004),
|
| 1010 |
+
(0.4667, 0.2748, 0.2748),
|
| 1011 |
+
(0.5451, 0.3205, 0.3205),
|
| 1012 |
+
(0.7843, 0.3961, 0.3961),
|
| 1013 |
+
(0.8941, 0.6651, 0.6651),
|
| 1014 |
+
(1.0000, 0.9843, 0.9843),
|
| 1015 |
+
)
|
| 1016 |
+
}
|
| 1017 |
+
|
| 1018 |
+
_gist_gray_data = {
|
| 1019 |
+
'red': gfunc[3],
|
| 1020 |
+
'green': gfunc[3],
|
| 1021 |
+
'blue': gfunc[3],
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
+
def _gist_heat_red(x): return 1.5 * x
|
| 1025 |
+
def _gist_heat_green(x): return 2 * x - 1
|
| 1026 |
+
def _gist_heat_blue(x): return 4 * x - 3
|
| 1027 |
+
_gist_heat_data = {
|
| 1028 |
+
'red': _gist_heat_red, 'green': _gist_heat_green, 'blue': _gist_heat_blue}
|
| 1029 |
+
|
| 1030 |
+
_gist_ncar_data = {
|
| 1031 |
+
'red': (
|
| 1032 |
+
(0.0, 0.0, 0.0000),
|
| 1033 |
+
(0.3098, 0.0000, 0.0000),
|
| 1034 |
+
(0.3725, 0.3993, 0.3993),
|
| 1035 |
+
(0.4235, 0.5003, 0.5003),
|
| 1036 |
+
(0.5333, 1.0000, 1.0000),
|
| 1037 |
+
(0.7922, 1.0000, 1.0000),
|
| 1038 |
+
(0.8471, 0.6218, 0.6218),
|
| 1039 |
+
(0.8980, 0.9235, 0.9235),
|
| 1040 |
+
(1.0000, 0.9961, 0.9961),
|
| 1041 |
+
),
|
| 1042 |
+
'green': (
|
| 1043 |
+
(0.0, 0.0, 0.0000),
|
| 1044 |
+
(0.0510, 0.3722, 0.3722),
|
| 1045 |
+
(0.1059, 0.0000, 0.0000),
|
| 1046 |
+
(0.1569, 0.7202, 0.7202),
|
| 1047 |
+
(0.1608, 0.7537, 0.7537),
|
| 1048 |
+
(0.1647, 0.7752, 0.7752),
|
| 1049 |
+
(0.2157, 1.0000, 1.0000),
|
| 1050 |
+
(0.2588, 0.9804, 0.9804),
|
| 1051 |
+
(0.2706, 0.9804, 0.9804),
|
| 1052 |
+
(0.3176, 1.0000, 1.0000),
|
| 1053 |
+
(0.3686, 0.8081, 0.8081),
|
| 1054 |
+
(0.4275, 1.0000, 1.0000),
|
| 1055 |
+
(0.5216, 1.0000, 1.0000),
|
| 1056 |
+
(0.6314, 0.7292, 0.7292),
|
| 1057 |
+
(0.6863, 0.2796, 0.2796),
|
| 1058 |
+
(0.7451, 0.0000, 0.0000),
|
| 1059 |
+
(0.7922, 0.0000, 0.0000),
|
| 1060 |
+
(0.8431, 0.1753, 0.1753),
|
| 1061 |
+
(0.8980, 0.5000, 0.5000),
|
| 1062 |
+
(1.0000, 0.9725, 0.9725),
|
| 1063 |
+
),
|
| 1064 |
+
'blue': (
|
| 1065 |
+
(0.0, 0.5020, 0.5020),
|
| 1066 |
+
(0.0510, 0.0222, 0.0222),
|
| 1067 |
+
(0.1098, 1.0000, 1.0000),
|
| 1068 |
+
(0.2039, 1.0000, 1.0000),
|
| 1069 |
+
(0.2627, 0.6145, 0.6145),
|
| 1070 |
+
(0.3216, 0.0000, 0.0000),
|
| 1071 |
+
(0.4157, 0.0000, 0.0000),
|
| 1072 |
+
(0.4745, 0.2342, 0.2342),
|
| 1073 |
+
(0.5333, 0.0000, 0.0000),
|
| 1074 |
+
(0.5804, 0.0000, 0.0000),
|
| 1075 |
+
(0.6314, 0.0549, 0.0549),
|
| 1076 |
+
(0.6902, 0.0000, 0.0000),
|
| 1077 |
+
(0.7373, 0.0000, 0.0000),
|
| 1078 |
+
(0.7922, 0.9738, 0.9738),
|
| 1079 |
+
(0.8000, 1.0000, 1.0000),
|
| 1080 |
+
(0.8431, 1.0000, 1.0000),
|
| 1081 |
+
(0.8980, 0.9341, 0.9341),
|
| 1082 |
+
(1.0000, 0.9961, 0.9961),
|
| 1083 |
+
)
|
| 1084 |
+
}
|
| 1085 |
+
|
| 1086 |
+
_gist_rainbow_data = (
|
| 1087 |
+
(0.000, (1.00, 0.00, 0.16)),
|
| 1088 |
+
(0.030, (1.00, 0.00, 0.00)),
|
| 1089 |
+
(0.215, (1.00, 1.00, 0.00)),
|
| 1090 |
+
(0.400, (0.00, 1.00, 0.00)),
|
| 1091 |
+
(0.586, (0.00, 1.00, 1.00)),
|
| 1092 |
+
(0.770, (0.00, 0.00, 1.00)),
|
| 1093 |
+
(0.954, (1.00, 0.00, 1.00)),
|
| 1094 |
+
(1.000, (1.00, 0.00, 0.75))
|
| 1095 |
+
)
|
| 1096 |
+
|
| 1097 |
+
_gist_stern_data = {
|
| 1098 |
+
'red': (
|
| 1099 |
+
(0.000, 0.000, 0.000), (0.0547, 1.000, 1.000),
|
| 1100 |
+
(0.250, 0.027, 0.250), # (0.2500, 0.250, 0.250),
|
| 1101 |
+
(1.000, 1.000, 1.000)),
|
| 1102 |
+
'green': ((0, 0, 0), (1, 1, 1)),
|
| 1103 |
+
'blue': (
|
| 1104 |
+
(0.000, 0.000, 0.000), (0.500, 1.000, 1.000),
|
| 1105 |
+
(0.735, 0.000, 0.000), (1.000, 1.000, 1.000))
|
| 1106 |
+
}
|
| 1107 |
+
|
| 1108 |
+
def _gist_yarg(x): return 1 - x
|
| 1109 |
+
_gist_yarg_data = {'red': _gist_yarg, 'green': _gist_yarg, 'blue': _gist_yarg}
|
| 1110 |
+
|
| 1111 |
+
# This bipolar colormap was generated from CoolWarmFloat33.csv of
|
| 1112 |
+
# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
|
| 1113 |
+
# <http://www.kennethmoreland.com/color-maps/>
|
| 1114 |
+
_coolwarm_data = {
|
| 1115 |
+
'red': [
|
| 1116 |
+
(0.0, 0.2298057, 0.2298057),
|
| 1117 |
+
(0.03125, 0.26623388, 0.26623388),
|
| 1118 |
+
(0.0625, 0.30386891, 0.30386891),
|
| 1119 |
+
(0.09375, 0.342804478, 0.342804478),
|
| 1120 |
+
(0.125, 0.38301334, 0.38301334),
|
| 1121 |
+
(0.15625, 0.424369608, 0.424369608),
|
| 1122 |
+
(0.1875, 0.46666708, 0.46666708),
|
| 1123 |
+
(0.21875, 0.509635204, 0.509635204),
|
| 1124 |
+
(0.25, 0.552953156, 0.552953156),
|
| 1125 |
+
(0.28125, 0.596262162, 0.596262162),
|
| 1126 |
+
(0.3125, 0.639176211, 0.639176211),
|
| 1127 |
+
(0.34375, 0.681291281, 0.681291281),
|
| 1128 |
+
(0.375, 0.722193294, 0.722193294),
|
| 1129 |
+
(0.40625, 0.761464949, 0.761464949),
|
| 1130 |
+
(0.4375, 0.798691636, 0.798691636),
|
| 1131 |
+
(0.46875, 0.833466556, 0.833466556),
|
| 1132 |
+
(0.5, 0.865395197, 0.865395197),
|
| 1133 |
+
(0.53125, 0.897787179, 0.897787179),
|
| 1134 |
+
(0.5625, 0.924127593, 0.924127593),
|
| 1135 |
+
(0.59375, 0.944468518, 0.944468518),
|
| 1136 |
+
(0.625, 0.958852946, 0.958852946),
|
| 1137 |
+
(0.65625, 0.96732803, 0.96732803),
|
| 1138 |
+
(0.6875, 0.969954137, 0.969954137),
|
| 1139 |
+
(0.71875, 0.966811177, 0.966811177),
|
| 1140 |
+
(0.75, 0.958003065, 0.958003065),
|
| 1141 |
+
(0.78125, 0.943660866, 0.943660866),
|
| 1142 |
+
(0.8125, 0.923944917, 0.923944917),
|
| 1143 |
+
(0.84375, 0.89904617, 0.89904617),
|
| 1144 |
+
(0.875, 0.869186849, 0.869186849),
|
| 1145 |
+
(0.90625, 0.834620542, 0.834620542),
|
| 1146 |
+
(0.9375, 0.795631745, 0.795631745),
|
| 1147 |
+
(0.96875, 0.752534934, 0.752534934),
|
| 1148 |
+
(1.0, 0.705673158, 0.705673158)],
|
| 1149 |
+
'green': [
|
| 1150 |
+
(0.0, 0.298717966, 0.298717966),
|
| 1151 |
+
(0.03125, 0.353094838, 0.353094838),
|
| 1152 |
+
(0.0625, 0.406535296, 0.406535296),
|
| 1153 |
+
(0.09375, 0.458757618, 0.458757618),
|
| 1154 |
+
(0.125, 0.50941904, 0.50941904),
|
| 1155 |
+
(0.15625, 0.558148092, 0.558148092),
|
| 1156 |
+
(0.1875, 0.604562568, 0.604562568),
|
| 1157 |
+
(0.21875, 0.648280772, 0.648280772),
|
| 1158 |
+
(0.25, 0.688929332, 0.688929332),
|
| 1159 |
+
(0.28125, 0.726149107, 0.726149107),
|
| 1160 |
+
(0.3125, 0.759599947, 0.759599947),
|
| 1161 |
+
(0.34375, 0.788964712, 0.788964712),
|
| 1162 |
+
(0.375, 0.813952739, 0.813952739),
|
| 1163 |
+
(0.40625, 0.834302879, 0.834302879),
|
| 1164 |
+
(0.4375, 0.849786142, 0.849786142),
|
| 1165 |
+
(0.46875, 0.860207984, 0.860207984),
|
| 1166 |
+
(0.5, 0.86541021, 0.86541021),
|
| 1167 |
+
(0.53125, 0.848937047, 0.848937047),
|
| 1168 |
+
(0.5625, 0.827384882, 0.827384882),
|
| 1169 |
+
(0.59375, 0.800927443, 0.800927443),
|
| 1170 |
+
(0.625, 0.769767752, 0.769767752),
|
| 1171 |
+
(0.65625, 0.734132809, 0.734132809),
|
| 1172 |
+
(0.6875, 0.694266682, 0.694266682),
|
| 1173 |
+
(0.71875, 0.650421156, 0.650421156),
|
| 1174 |
+
(0.75, 0.602842431, 0.602842431),
|
| 1175 |
+
(0.78125, 0.551750968, 0.551750968),
|
| 1176 |
+
(0.8125, 0.49730856, 0.49730856),
|
| 1177 |
+
(0.84375, 0.439559467, 0.439559467),
|
| 1178 |
+
(0.875, 0.378313092, 0.378313092),
|
| 1179 |
+
(0.90625, 0.312874446, 0.312874446),
|
| 1180 |
+
(0.9375, 0.24128379, 0.24128379),
|
| 1181 |
+
(0.96875, 0.157246067, 0.157246067),
|
| 1182 |
+
(1.0, 0.01555616, 0.01555616)],
|
| 1183 |
+
'blue': [
|
| 1184 |
+
(0.0, 0.753683153, 0.753683153),
|
| 1185 |
+
(0.03125, 0.801466763, 0.801466763),
|
| 1186 |
+
(0.0625, 0.84495867, 0.84495867),
|
| 1187 |
+
(0.09375, 0.883725899, 0.883725899),
|
| 1188 |
+
(0.125, 0.917387822, 0.917387822),
|
| 1189 |
+
(0.15625, 0.945619588, 0.945619588),
|
| 1190 |
+
(0.1875, 0.968154911, 0.968154911),
|
| 1191 |
+
(0.21875, 0.98478814, 0.98478814),
|
| 1192 |
+
(0.25, 0.995375608, 0.995375608),
|
| 1193 |
+
(0.28125, 0.999836203, 0.999836203),
|
| 1194 |
+
(0.3125, 0.998151185, 0.998151185),
|
| 1195 |
+
(0.34375, 0.990363227, 0.990363227),
|
| 1196 |
+
(0.375, 0.976574709, 0.976574709),
|
| 1197 |
+
(0.40625, 0.956945269, 0.956945269),
|
| 1198 |
+
(0.4375, 0.931688648, 0.931688648),
|
| 1199 |
+
(0.46875, 0.901068838, 0.901068838),
|
| 1200 |
+
(0.5, 0.865395561, 0.865395561),
|
| 1201 |
+
(0.53125, 0.820880546, 0.820880546),
|
| 1202 |
+
(0.5625, 0.774508472, 0.774508472),
|
| 1203 |
+
(0.59375, 0.726736146, 0.726736146),
|
| 1204 |
+
(0.625, 0.678007945, 0.678007945),
|
| 1205 |
+
(0.65625, 0.628751763, 0.628751763),
|
| 1206 |
+
(0.6875, 0.579375448, 0.579375448),
|
| 1207 |
+
(0.71875, 0.530263762, 0.530263762),
|
| 1208 |
+
(0.75, 0.481775914, 0.481775914),
|
| 1209 |
+
(0.78125, 0.434243684, 0.434243684),
|
| 1210 |
+
(0.8125, 0.387970225, 0.387970225),
|
| 1211 |
+
(0.84375, 0.343229596, 0.343229596),
|
| 1212 |
+
(0.875, 0.300267182, 0.300267182),
|
| 1213 |
+
(0.90625, 0.259301199, 0.259301199),
|
| 1214 |
+
(0.9375, 0.220525627, 0.220525627),
|
| 1215 |
+
(0.96875, 0.184115123, 0.184115123),
|
| 1216 |
+
(1.0, 0.150232812, 0.150232812)]
|
| 1217 |
+
}
|
| 1218 |
+
|
| 1219 |
+
# Implementation of Carey Rappaport's CMRmap.
|
| 1220 |
+
# See `A Color Map for Effective Black-and-White Rendering of Color-Scale
|
| 1221 |
+
# Images' by Carey Rappaport
|
| 1222 |
+
# https://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m
|
| 1223 |
+
_CMRmap_data = {'red': ((0.000, 0.00, 0.00),
|
| 1224 |
+
(0.125, 0.15, 0.15),
|
| 1225 |
+
(0.250, 0.30, 0.30),
|
| 1226 |
+
(0.375, 0.60, 0.60),
|
| 1227 |
+
(0.500, 1.00, 1.00),
|
| 1228 |
+
(0.625, 0.90, 0.90),
|
| 1229 |
+
(0.750, 0.90, 0.90),
|
| 1230 |
+
(0.875, 0.90, 0.90),
|
| 1231 |
+
(1.000, 1.00, 1.00)),
|
| 1232 |
+
'green': ((0.000, 0.00, 0.00),
|
| 1233 |
+
(0.125, 0.15, 0.15),
|
| 1234 |
+
(0.250, 0.15, 0.15),
|
| 1235 |
+
(0.375, 0.20, 0.20),
|
| 1236 |
+
(0.500, 0.25, 0.25),
|
| 1237 |
+
(0.625, 0.50, 0.50),
|
| 1238 |
+
(0.750, 0.75, 0.75),
|
| 1239 |
+
(0.875, 0.90, 0.90),
|
| 1240 |
+
(1.000, 1.00, 1.00)),
|
| 1241 |
+
'blue': ((0.000, 0.00, 0.00),
|
| 1242 |
+
(0.125, 0.50, 0.50),
|
| 1243 |
+
(0.250, 0.75, 0.75),
|
| 1244 |
+
(0.375, 0.50, 0.50),
|
| 1245 |
+
(0.500, 0.15, 0.15),
|
| 1246 |
+
(0.625, 0.00, 0.00),
|
| 1247 |
+
(0.750, 0.10, 0.10),
|
| 1248 |
+
(0.875, 0.50, 0.50),
|
| 1249 |
+
(1.000, 1.00, 1.00))}
|
| 1250 |
+
|
| 1251 |
+
|
| 1252 |
+
# An MIT licensed, colorblind-friendly heatmap from Wistia:
|
| 1253 |
+
# https://github.com/wistia/heatmap-palette
|
| 1254 |
+
# https://wistia.com/learn/culture/heatmaps-for-colorblindness
|
| 1255 |
+
#
|
| 1256 |
+
# >>> import matplotlib.colors as c
|
| 1257 |
+
# >>> colors = ["#e4ff7a", "#ffe81a", "#ffbd00", "#ffa000", "#fc7f00"]
|
| 1258 |
+
# >>> cm = c.LinearSegmentedColormap.from_list('wistia', colors)
|
| 1259 |
+
# >>> _wistia_data = cm._segmentdata
|
| 1260 |
+
# >>> del _wistia_data['alpha']
|
| 1261 |
+
#
|
| 1262 |
+
_wistia_data = {
|
| 1263 |
+
'red': [(0.0, 0.8941176470588236, 0.8941176470588236),
|
| 1264 |
+
(0.25, 1.0, 1.0),
|
| 1265 |
+
(0.5, 1.0, 1.0),
|
| 1266 |
+
(0.75, 1.0, 1.0),
|
| 1267 |
+
(1.0, 0.9882352941176471, 0.9882352941176471)],
|
| 1268 |
+
'green': [(0.0, 1.0, 1.0),
|
| 1269 |
+
(0.25, 0.9098039215686274, 0.9098039215686274),
|
| 1270 |
+
(0.5, 0.7411764705882353, 0.7411764705882353),
|
| 1271 |
+
(0.75, 0.6274509803921569, 0.6274509803921569),
|
| 1272 |
+
(1.0, 0.4980392156862745, 0.4980392156862745)],
|
| 1273 |
+
'blue': [(0.0, 0.47843137254901963, 0.47843137254901963),
|
| 1274 |
+
(0.25, 0.10196078431372549, 0.10196078431372549),
|
| 1275 |
+
(0.5, 0.0, 0.0),
|
| 1276 |
+
(0.75, 0.0, 0.0),
|
| 1277 |
+
(1.0, 0.0, 0.0)],
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
|
| 1281 |
+
# Categorical palettes from Vega:
|
| 1282 |
+
# https://github.com/vega/vega/wiki/Scales
|
| 1283 |
+
# (divided by 255)
|
| 1284 |
+
#
|
| 1285 |
+
|
| 1286 |
+
_tab10_data = (
|
| 1287 |
+
(0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
|
| 1288 |
+
(1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
|
| 1289 |
+
(0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
|
| 1290 |
+
(0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
|
| 1291 |
+
(0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
|
| 1292 |
+
(0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
|
| 1293 |
+
(0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
|
| 1294 |
+
(0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
|
| 1295 |
+
(0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
|
| 1296 |
+
(0.09019607843137255, 0.7450980392156863, 0.8117647058823529), # 17becf
|
| 1297 |
+
)
|
| 1298 |
+
|
| 1299 |
+
_tab20_data = (
|
| 1300 |
+
(0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
|
| 1301 |
+
(0.6823529411764706, 0.7803921568627451, 0.9098039215686274 ), # aec7e8
|
| 1302 |
+
(1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
|
| 1303 |
+
(1.0, 0.7333333333333333, 0.47058823529411764 ), # ffbb78
|
| 1304 |
+
(0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
|
| 1305 |
+
(0.596078431372549, 0.8745098039215686, 0.5411764705882353 ), # 98df8a
|
| 1306 |
+
(0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
|
| 1307 |
+
(1.0, 0.596078431372549, 0.5882352941176471 ), # ff9896
|
| 1308 |
+
(0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
|
| 1309 |
+
(0.7725490196078432, 0.6901960784313725, 0.8352941176470589 ), # c5b0d5
|
| 1310 |
+
(0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
|
| 1311 |
+
(0.7686274509803922, 0.611764705882353, 0.5803921568627451 ), # c49c94
|
| 1312 |
+
(0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
|
| 1313 |
+
(0.9686274509803922, 0.7137254901960784, 0.8235294117647058 ), # f7b6d2
|
| 1314 |
+
(0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
|
| 1315 |
+
(0.7803921568627451, 0.7803921568627451, 0.7803921568627451 ), # c7c7c7
|
| 1316 |
+
(0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
|
| 1317 |
+
(0.8588235294117647, 0.8588235294117647, 0.5529411764705883 ), # dbdb8d
|
| 1318 |
+
(0.09019607843137255, 0.7450980392156863, 0.8117647058823529 ), # 17becf
|
| 1319 |
+
(0.6196078431372549, 0.8549019607843137, 0.8980392156862745), # 9edae5
|
| 1320 |
+
)
|
| 1321 |
+
|
| 1322 |
+
_tab20b_data = (
|
| 1323 |
+
(0.2235294117647059, 0.23137254901960785, 0.4745098039215686 ), # 393b79
|
| 1324 |
+
(0.3215686274509804, 0.32941176470588235, 0.6392156862745098 ), # 5254a3
|
| 1325 |
+
(0.4196078431372549, 0.43137254901960786, 0.8117647058823529 ), # 6b6ecf
|
| 1326 |
+
(0.611764705882353, 0.6196078431372549, 0.8705882352941177 ), # 9c9ede
|
| 1327 |
+
(0.38823529411764707, 0.4745098039215686, 0.2235294117647059 ), # 637939
|
| 1328 |
+
(0.5490196078431373, 0.6352941176470588, 0.3215686274509804 ), # 8ca252
|
| 1329 |
+
(0.7098039215686275, 0.8117647058823529, 0.4196078431372549 ), # b5cf6b
|
| 1330 |
+
(0.807843137254902, 0.8588235294117647, 0.611764705882353 ), # cedb9c
|
| 1331 |
+
(0.5490196078431373, 0.42745098039215684, 0.19215686274509805), # 8c6d31
|
| 1332 |
+
(0.7411764705882353, 0.6196078431372549, 0.2235294117647059 ), # bd9e39
|
| 1333 |
+
(0.9058823529411765, 0.7294117647058823, 0.3215686274509804 ), # e7ba52
|
| 1334 |
+
(0.9058823529411765, 0.796078431372549, 0.5803921568627451 ), # e7cb94
|
| 1335 |
+
(0.5176470588235295, 0.23529411764705882, 0.2235294117647059 ), # 843c39
|
| 1336 |
+
(0.6784313725490196, 0.28627450980392155, 0.2901960784313726 ), # ad494a
|
| 1337 |
+
(0.8392156862745098, 0.3803921568627451, 0.4196078431372549 ), # d6616b
|
| 1338 |
+
(0.9058823529411765, 0.5882352941176471, 0.611764705882353 ), # e7969c
|
| 1339 |
+
(0.4823529411764706, 0.2549019607843137, 0.45098039215686275), # 7b4173
|
| 1340 |
+
(0.6470588235294118, 0.3176470588235294, 0.5803921568627451 ), # a55194
|
| 1341 |
+
(0.807843137254902, 0.42745098039215684, 0.7411764705882353 ), # ce6dbd
|
| 1342 |
+
(0.8705882352941177, 0.6196078431372549, 0.8392156862745098 ), # de9ed6
|
| 1343 |
+
)
|
| 1344 |
+
|
| 1345 |
+
_tab20c_data = (
|
| 1346 |
+
(0.19215686274509805, 0.5098039215686274, 0.7411764705882353 ), # 3182bd
|
| 1347 |
+
(0.4196078431372549, 0.6823529411764706, 0.8392156862745098 ), # 6baed6
|
| 1348 |
+
(0.6196078431372549, 0.792156862745098, 0.8823529411764706 ), # 9ecae1
|
| 1349 |
+
(0.7764705882352941, 0.8588235294117647, 0.9372549019607843 ), # c6dbef
|
| 1350 |
+
(0.9019607843137255, 0.3333333333333333, 0.050980392156862744), # e6550d
|
| 1351 |
+
(0.9921568627450981, 0.5529411764705883, 0.23529411764705882 ), # fd8d3c
|
| 1352 |
+
(0.9921568627450981, 0.6823529411764706, 0.4196078431372549 ), # fdae6b
|
| 1353 |
+
(0.9921568627450981, 0.8156862745098039, 0.6352941176470588 ), # fdd0a2
|
| 1354 |
+
(0.19215686274509805, 0.6392156862745098, 0.32941176470588235 ), # 31a354
|
| 1355 |
+
(0.4549019607843137, 0.7686274509803922, 0.4627450980392157 ), # 74c476
|
| 1356 |
+
(0.6313725490196078, 0.8509803921568627, 0.6078431372549019 ), # a1d99b
|
| 1357 |
+
(0.7803921568627451, 0.9137254901960784, 0.7529411764705882 ), # c7e9c0
|
| 1358 |
+
(0.4588235294117647, 0.4196078431372549, 0.6941176470588235 ), # 756bb1
|
| 1359 |
+
(0.6196078431372549, 0.6039215686274509, 0.7843137254901961 ), # 9e9ac8
|
| 1360 |
+
(0.7372549019607844, 0.7411764705882353, 0.8627450980392157 ), # bcbddc
|
| 1361 |
+
(0.8549019607843137, 0.8549019607843137, 0.9215686274509803 ), # dadaeb
|
| 1362 |
+
(0.38823529411764707, 0.38823529411764707, 0.38823529411764707 ), # 636363
|
| 1363 |
+
(0.5882352941176471, 0.5882352941176471, 0.5882352941176471 ), # 969696
|
| 1364 |
+
(0.7411764705882353, 0.7411764705882353, 0.7411764705882353 ), # bdbdbd
|
| 1365 |
+
(0.8509803921568627, 0.8509803921568627, 0.8509803921568627 ), # d9d9d9
|
| 1366 |
+
)
|
| 1367 |
+
|
| 1368 |
+
|
| 1369 |
+
_petroff10_data = (
|
| 1370 |
+
(0.24705882352941178, 0.5647058823529412, 0.8549019607843137), # 3f90da
|
| 1371 |
+
(1.0, 0.6627450980392157, 0.054901960784313725), # ffa90e
|
| 1372 |
+
(0.7411764705882353, 0.12156862745098039, 0.00392156862745098), # bd1f01
|
| 1373 |
+
(0.5803921568627451, 0.6431372549019608, 0.6352941176470588), # 94a4a2
|
| 1374 |
+
(0.5137254901960784, 0.17647058823529413, 0.7137254901960784), # 832db6
|
| 1375 |
+
(0.6627450980392157, 0.4196078431372549, 0.34901960784313724), # a96b59
|
| 1376 |
+
(0.9058823529411765, 0.38823529411764707, 0.0), # e76300
|
| 1377 |
+
(0.7254901960784313, 0.6745098039215687, 0.4392156862745098), # b9ac70
|
| 1378 |
+
(0.44313725490196076, 0.4588235294117647, 0.5058823529411764), # 717581
|
| 1379 |
+
(0.5725490196078431, 0.8549019607843137, 0.8666666666666667), # 92dadd
|
| 1380 |
+
)
|
| 1381 |
+
|
| 1382 |
+
|
| 1383 |
+
datad = {
|
| 1384 |
+
'Blues': _Blues_data,
|
| 1385 |
+
'BrBG': _BrBG_data,
|
| 1386 |
+
'BuGn': _BuGn_data,
|
| 1387 |
+
'BuPu': _BuPu_data,
|
| 1388 |
+
'CMRmap': _CMRmap_data,
|
| 1389 |
+
'GnBu': _GnBu_data,
|
| 1390 |
+
'Greens': _Greens_data,
|
| 1391 |
+
'Greys': _Greys_data,
|
| 1392 |
+
'OrRd': _OrRd_data,
|
| 1393 |
+
'Oranges': _Oranges_data,
|
| 1394 |
+
'PRGn': _PRGn_data,
|
| 1395 |
+
'PiYG': _PiYG_data,
|
| 1396 |
+
'PuBu': _PuBu_data,
|
| 1397 |
+
'PuBuGn': _PuBuGn_data,
|
| 1398 |
+
'PuOr': _PuOr_data,
|
| 1399 |
+
'PuRd': _PuRd_data,
|
| 1400 |
+
'Purples': _Purples_data,
|
| 1401 |
+
'RdBu': _RdBu_data,
|
| 1402 |
+
'RdGy': _RdGy_data,
|
| 1403 |
+
'RdPu': _RdPu_data,
|
| 1404 |
+
'RdYlBu': _RdYlBu_data,
|
| 1405 |
+
'RdYlGn': _RdYlGn_data,
|
| 1406 |
+
'Reds': _Reds_data,
|
| 1407 |
+
'Spectral': _Spectral_data,
|
| 1408 |
+
'Wistia': _wistia_data,
|
| 1409 |
+
'YlGn': _YlGn_data,
|
| 1410 |
+
'YlGnBu': _YlGnBu_data,
|
| 1411 |
+
'YlOrBr': _YlOrBr_data,
|
| 1412 |
+
'YlOrRd': _YlOrRd_data,
|
| 1413 |
+
'afmhot': _afmhot_data,
|
| 1414 |
+
'autumn': _autumn_data,
|
| 1415 |
+
'binary': _binary_data,
|
| 1416 |
+
'bone': _bone_data,
|
| 1417 |
+
'brg': _brg_data,
|
| 1418 |
+
'bwr': _bwr_data,
|
| 1419 |
+
'cool': _cool_data,
|
| 1420 |
+
'coolwarm': _coolwarm_data,
|
| 1421 |
+
'copper': _copper_data,
|
| 1422 |
+
'cubehelix': _cubehelix_data,
|
| 1423 |
+
'flag': _flag_data,
|
| 1424 |
+
'gist_earth': _gist_earth_data,
|
| 1425 |
+
'gist_gray': _gist_gray_data,
|
| 1426 |
+
'gist_heat': _gist_heat_data,
|
| 1427 |
+
'gist_ncar': _gist_ncar_data,
|
| 1428 |
+
'gist_rainbow': _gist_rainbow_data,
|
| 1429 |
+
'gist_stern': _gist_stern_data,
|
| 1430 |
+
'gist_yarg': _gist_yarg_data,
|
| 1431 |
+
'gnuplot': _gnuplot_data,
|
| 1432 |
+
'gnuplot2': _gnuplot2_data,
|
| 1433 |
+
'gray': _gray_data,
|
| 1434 |
+
'hot': _hot_data,
|
| 1435 |
+
'hsv': _hsv_data,
|
| 1436 |
+
'jet': _jet_data,
|
| 1437 |
+
'nipy_spectral': _nipy_spectral_data,
|
| 1438 |
+
'ocean': _ocean_data,
|
| 1439 |
+
'pink': _pink_data,
|
| 1440 |
+
'prism': _prism_data,
|
| 1441 |
+
'rainbow': _rainbow_data,
|
| 1442 |
+
'seismic': _seismic_data,
|
| 1443 |
+
'spring': _spring_data,
|
| 1444 |
+
'summer': _summer_data,
|
| 1445 |
+
'terrain': _terrain_data,
|
| 1446 |
+
'winter': _winter_data,
|
| 1447 |
+
# Qualitative
|
| 1448 |
+
'Accent': {'listed': _Accent_data},
|
| 1449 |
+
'Dark2': {'listed': _Dark2_data},
|
| 1450 |
+
'Paired': {'listed': _Paired_data},
|
| 1451 |
+
'Pastel1': {'listed': _Pastel1_data},
|
| 1452 |
+
'Pastel2': {'listed': _Pastel2_data},
|
| 1453 |
+
'Set1': {'listed': _Set1_data},
|
| 1454 |
+
'Set2': {'listed': _Set2_data},
|
| 1455 |
+
'Set3': {'listed': _Set3_data},
|
| 1456 |
+
'tab10': {'listed': _tab10_data},
|
| 1457 |
+
'tab20': {'listed': _tab20_data},
|
| 1458 |
+
'tab20b': {'listed': _tab20b_data},
|
| 1459 |
+
'tab20c': {'listed': _tab20c_data},
|
| 1460 |
+
}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_bivar.py
ADDED
|
@@ -0,0 +1,1312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
from matplotlib.colors import SegmentedBivarColormap
|
| 6 |
+
|
| 7 |
+
BiPeak = np.array(
|
| 8 |
+
[0.000, 0.674, 0.931, 0.000, 0.680, 0.922, 0.000, 0.685, 0.914, 0.000,
|
| 9 |
+
0.691, 0.906, 0.000, 0.696, 0.898, 0.000, 0.701, 0.890, 0.000, 0.706,
|
| 10 |
+
0.882, 0.000, 0.711, 0.875, 0.000, 0.715, 0.867, 0.000, 0.720, 0.860,
|
| 11 |
+
0.000, 0.725, 0.853, 0.000, 0.729, 0.845, 0.000, 0.733, 0.838, 0.000,
|
| 12 |
+
0.737, 0.831, 0.000, 0.741, 0.824, 0.000, 0.745, 0.816, 0.000, 0.749,
|
| 13 |
+
0.809, 0.000, 0.752, 0.802, 0.000, 0.756, 0.794, 0.000, 0.759, 0.787,
|
| 14 |
+
0.000, 0.762, 0.779, 0.000, 0.765, 0.771, 0.000, 0.767, 0.764, 0.000,
|
| 15 |
+
0.770, 0.755, 0.000, 0.772, 0.747, 0.000, 0.774, 0.739, 0.000, 0.776,
|
| 16 |
+
0.730, 0.000, 0.777, 0.721, 0.000, 0.779, 0.712, 0.021, 0.780, 0.702,
|
| 17 |
+
0.055, 0.781, 0.693, 0.079, 0.782, 0.682, 0.097, 0.782, 0.672, 0.111,
|
| 18 |
+
0.782, 0.661, 0.122, 0.782, 0.650, 0.132, 0.782, 0.639, 0.140, 0.781,
|
| 19 |
+
0.627, 0.147, 0.781, 0.615, 0.154, 0.780, 0.602, 0.159, 0.778, 0.589,
|
| 20 |
+
0.164, 0.777, 0.576, 0.169, 0.775, 0.563, 0.173, 0.773, 0.549, 0.177,
|
| 21 |
+
0.771, 0.535, 0.180, 0.768, 0.520, 0.184, 0.766, 0.505, 0.187, 0.763,
|
| 22 |
+
0.490, 0.190, 0.760, 0.474, 0.193, 0.756, 0.458, 0.196, 0.753, 0.442,
|
| 23 |
+
0.200, 0.749, 0.425, 0.203, 0.745, 0.408, 0.206, 0.741, 0.391, 0.210,
|
| 24 |
+
0.736, 0.373, 0.213, 0.732, 0.355, 0.216, 0.727, 0.337, 0.220, 0.722,
|
| 25 |
+
0.318, 0.224, 0.717, 0.298, 0.227, 0.712, 0.278, 0.231, 0.707, 0.258,
|
| 26 |
+
0.235, 0.701, 0.236, 0.239, 0.696, 0.214, 0.242, 0.690, 0.190, 0.246,
|
| 27 |
+
0.684, 0.165, 0.250, 0.678, 0.136, 0.000, 0.675, 0.934, 0.000, 0.681,
|
| 28 |
+
0.925, 0.000, 0.687, 0.917, 0.000, 0.692, 0.909, 0.000, 0.697, 0.901,
|
| 29 |
+
0.000, 0.703, 0.894, 0.000, 0.708, 0.886, 0.000, 0.713, 0.879, 0.000,
|
| 30 |
+
0.718, 0.872, 0.000, 0.722, 0.864, 0.000, 0.727, 0.857, 0.000, 0.731,
|
| 31 |
+
0.850, 0.000, 0.736, 0.843, 0.000, 0.740, 0.836, 0.000, 0.744, 0.829,
|
| 32 |
+
0.000, 0.748, 0.822, 0.000, 0.752, 0.815, 0.000, 0.755, 0.808, 0.000,
|
| 33 |
+
0.759, 0.800, 0.000, 0.762, 0.793, 0.000, 0.765, 0.786, 0.000, 0.768,
|
| 34 |
+
0.778, 0.000, 0.771, 0.770, 0.000, 0.773, 0.762, 0.051, 0.776, 0.754,
|
| 35 |
+
0.087, 0.778, 0.746, 0.111, 0.780, 0.737, 0.131, 0.782, 0.728, 0.146,
|
| 36 |
+
0.783, 0.719, 0.159, 0.784, 0.710, 0.171, 0.785, 0.700, 0.180, 0.786,
|
| 37 |
+
0.690, 0.189, 0.786, 0.680, 0.196, 0.787, 0.669, 0.202, 0.787, 0.658,
|
| 38 |
+
0.208, 0.786, 0.647, 0.213, 0.786, 0.635, 0.217, 0.785, 0.623, 0.221,
|
| 39 |
+
0.784, 0.610, 0.224, 0.782, 0.597, 0.227, 0.781, 0.584, 0.230, 0.779,
|
| 40 |
+
0.570, 0.232, 0.777, 0.556, 0.234, 0.775, 0.542, 0.236, 0.772, 0.527,
|
| 41 |
+
0.238, 0.769, 0.512, 0.240, 0.766, 0.497, 0.242, 0.763, 0.481, 0.244,
|
| 42 |
+
0.760, 0.465, 0.246, 0.756, 0.448, 0.248, 0.752, 0.432, 0.250, 0.748,
|
| 43 |
+
0.415, 0.252, 0.744, 0.397, 0.254, 0.739, 0.379, 0.256, 0.735, 0.361,
|
| 44 |
+
0.259, 0.730, 0.343, 0.261, 0.725, 0.324, 0.264, 0.720, 0.304, 0.266,
|
| 45 |
+
0.715, 0.284, 0.269, 0.709, 0.263, 0.271, 0.704, 0.242, 0.274, 0.698,
|
| 46 |
+
0.220, 0.277, 0.692, 0.196, 0.280, 0.686, 0.170, 0.283, 0.680, 0.143,
|
| 47 |
+
0.000, 0.676, 0.937, 0.000, 0.682, 0.928, 0.000, 0.688, 0.920, 0.000,
|
| 48 |
+
0.694, 0.913, 0.000, 0.699, 0.905, 0.000, 0.704, 0.897, 0.000, 0.710,
|
| 49 |
+
0.890, 0.000, 0.715, 0.883, 0.000, 0.720, 0.876, 0.000, 0.724, 0.869,
|
| 50 |
+
0.000, 0.729, 0.862, 0.000, 0.734, 0.855, 0.000, 0.738, 0.848, 0.000,
|
| 51 |
+
0.743, 0.841, 0.000, 0.747, 0.834, 0.000, 0.751, 0.827, 0.000, 0.755,
|
| 52 |
+
0.820, 0.000, 0.759, 0.813, 0.000, 0.762, 0.806, 0.003, 0.766, 0.799,
|
| 53 |
+
0.066, 0.769, 0.792, 0.104, 0.772, 0.784, 0.131, 0.775, 0.777, 0.152,
|
| 54 |
+
0.777, 0.769, 0.170, 0.780, 0.761, 0.185, 0.782, 0.753, 0.198, 0.784,
|
| 55 |
+
0.744, 0.209, 0.786, 0.736, 0.219, 0.787, 0.727, 0.228, 0.788, 0.717,
|
| 56 |
+
0.236, 0.789, 0.708, 0.243, 0.790, 0.698, 0.249, 0.791, 0.688, 0.254,
|
| 57 |
+
0.791, 0.677, 0.259, 0.791, 0.666, 0.263, 0.791, 0.654, 0.266, 0.790,
|
| 58 |
+
0.643, 0.269, 0.789, 0.631, 0.272, 0.788, 0.618, 0.274, 0.787, 0.605,
|
| 59 |
+
0.276, 0.785, 0.592, 0.278, 0.783, 0.578, 0.279, 0.781, 0.564, 0.280,
|
| 60 |
+
0.779, 0.549, 0.282, 0.776, 0.535, 0.283, 0.773, 0.519, 0.284, 0.770,
|
| 61 |
+
0.504, 0.285, 0.767, 0.488, 0.286, 0.763, 0.472, 0.287, 0.759, 0.455,
|
| 62 |
+
0.288, 0.756, 0.438, 0.289, 0.751, 0.421, 0.291, 0.747, 0.403, 0.292,
|
| 63 |
+
0.742, 0.385, 0.293, 0.738, 0.367, 0.295, 0.733, 0.348, 0.296, 0.728,
|
| 64 |
+
0.329, 0.298, 0.723, 0.310, 0.300, 0.717, 0.290, 0.302, 0.712, 0.269,
|
| 65 |
+
0.304, 0.706, 0.247, 0.306, 0.700, 0.225, 0.308, 0.694, 0.201, 0.310,
|
| 66 |
+
0.688, 0.176, 0.312, 0.682, 0.149, 0.000, 0.678, 0.939, 0.000, 0.683,
|
| 67 |
+
0.931, 0.000, 0.689, 0.923, 0.000, 0.695, 0.916, 0.000, 0.701, 0.908,
|
| 68 |
+
0.000, 0.706, 0.901, 0.000, 0.711, 0.894, 0.000, 0.717, 0.887, 0.000,
|
| 69 |
+
0.722, 0.880, 0.000, 0.727, 0.873, 0.000, 0.732, 0.866, 0.000, 0.736,
|
| 70 |
+
0.859, 0.000, 0.741, 0.853, 0.000, 0.745, 0.846, 0.000, 0.750, 0.839,
|
| 71 |
+
0.000, 0.754, 0.833, 0.035, 0.758, 0.826, 0.091, 0.762, 0.819, 0.126,
|
| 72 |
+
0.765, 0.812, 0.153, 0.769, 0.805, 0.174, 0.772, 0.798, 0.193, 0.775,
|
| 73 |
+
0.791, 0.209, 0.778, 0.783, 0.223, 0.781, 0.776, 0.236, 0.784, 0.768,
|
| 74 |
+
0.247, 0.786, 0.760, 0.257, 0.788, 0.752, 0.266, 0.790, 0.743, 0.273,
|
| 75 |
+
0.791, 0.734, 0.280, 0.793, 0.725, 0.287, 0.794, 0.715, 0.292, 0.794,
|
| 76 |
+
0.706, 0.297, 0.795, 0.695, 0.301, 0.795, 0.685, 0.305, 0.795, 0.674,
|
| 77 |
+
0.308, 0.795, 0.662, 0.310, 0.794, 0.651, 0.312, 0.794, 0.638, 0.314,
|
| 78 |
+
0.792, 0.626, 0.316, 0.791, 0.613, 0.317, 0.789, 0.599, 0.318, 0.787,
|
| 79 |
+
0.586, 0.319, 0.785, 0.571, 0.320, 0.783, 0.557, 0.320, 0.780, 0.542,
|
| 80 |
+
0.321, 0.777, 0.527, 0.321, 0.774, 0.511, 0.322, 0.770, 0.495, 0.322,
|
| 81 |
+
0.767, 0.478, 0.323, 0.763, 0.462, 0.323, 0.759, 0.445, 0.324, 0.755,
|
| 82 |
+
0.427, 0.325, 0.750, 0.410, 0.325, 0.745, 0.391, 0.326, 0.741, 0.373,
|
| 83 |
+
0.327, 0.736, 0.354, 0.328, 0.730, 0.335, 0.329, 0.725, 0.315, 0.330,
|
| 84 |
+
0.720, 0.295, 0.331, 0.714, 0.274, 0.333, 0.708, 0.253, 0.334, 0.702,
|
| 85 |
+
0.230, 0.336, 0.696, 0.207, 0.337, 0.690, 0.182, 0.339, 0.684, 0.154,
|
| 86 |
+
0.000, 0.679, 0.942, 0.000, 0.685, 0.934, 0.000, 0.691, 0.927, 0.000,
|
| 87 |
+
0.696, 0.919, 0.000, 0.702, 0.912, 0.000, 0.708, 0.905, 0.000, 0.713,
|
| 88 |
+
0.898, 0.000, 0.718, 0.891, 0.000, 0.724, 0.884, 0.000, 0.729, 0.877,
|
| 89 |
+
0.000, 0.734, 0.871, 0.000, 0.739, 0.864, 0.000, 0.743, 0.857, 0.035,
|
| 90 |
+
0.748, 0.851, 0.096, 0.752, 0.844, 0.133, 0.757, 0.838, 0.161, 0.761,
|
| 91 |
+
0.831, 0.185, 0.765, 0.825, 0.205, 0.769, 0.818, 0.223, 0.772, 0.811,
|
| 92 |
+
0.238, 0.776, 0.804, 0.252, 0.779, 0.797, 0.265, 0.782, 0.790, 0.276,
|
| 93 |
+
0.785, 0.783, 0.286, 0.788, 0.775, 0.296, 0.790, 0.767, 0.304, 0.792,
|
| 94 |
+
0.759, 0.311, 0.794, 0.751, 0.318, 0.796, 0.742, 0.324, 0.797, 0.733,
|
| 95 |
+
0.329, 0.798, 0.723, 0.334, 0.799, 0.714, 0.338, 0.799, 0.703, 0.341,
|
| 96 |
+
0.800, 0.693, 0.344, 0.800, 0.682, 0.347, 0.799, 0.670, 0.349, 0.799,
|
| 97 |
+
0.659, 0.351, 0.798, 0.646, 0.352, 0.797, 0.634, 0.353, 0.795, 0.621,
|
| 98 |
+
0.354, 0.794, 0.607, 0.354, 0.792, 0.593, 0.355, 0.789, 0.579, 0.355,
|
| 99 |
+
0.787, 0.564, 0.355, 0.784, 0.549, 0.355, 0.781, 0.534, 0.355, 0.778,
|
| 100 |
+
0.518, 0.355, 0.774, 0.502, 0.355, 0.770, 0.485, 0.355, 0.766, 0.468,
|
| 101 |
+
0.355, 0.762, 0.451, 0.355, 0.758, 0.434, 0.355, 0.753, 0.416, 0.356,
|
| 102 |
+
0.748, 0.397, 0.356, 0.743, 0.379, 0.356, 0.738, 0.360, 0.357, 0.733,
|
| 103 |
+
0.340, 0.357, 0.728, 0.321, 0.358, 0.722, 0.300, 0.359, 0.716, 0.279,
|
| 104 |
+
0.360, 0.710, 0.258, 0.361, 0.704, 0.235, 0.361, 0.698, 0.212, 0.362,
|
| 105 |
+
0.692, 0.187, 0.363, 0.686, 0.160, 0.000, 0.680, 0.945, 0.000, 0.686,
|
| 106 |
+
0.937, 0.000, 0.692, 0.930, 0.000, 0.698, 0.922, 0.000, 0.703, 0.915,
|
| 107 |
+
0.000, 0.709, 0.908, 0.000, 0.715, 0.901, 0.000, 0.720, 0.894, 0.000,
|
| 108 |
+
0.726, 0.888, 0.000, 0.731, 0.881, 0.007, 0.736, 0.875, 0.084, 0.741,
|
| 109 |
+
0.869, 0.127, 0.746, 0.862, 0.159, 0.751, 0.856, 0.185, 0.755, 0.850,
|
| 110 |
+
0.208, 0.760, 0.843, 0.227, 0.764, 0.837, 0.245, 0.768, 0.830, 0.260,
|
| 111 |
+
0.772, 0.824, 0.275, 0.776, 0.817, 0.288, 0.779, 0.811, 0.300, 0.783,
|
| 112 |
+
0.804, 0.310, 0.786, 0.797, 0.320, 0.789, 0.789, 0.329, 0.792, 0.782,
|
| 113 |
+
0.337, 0.794, 0.774, 0.345, 0.796, 0.766, 0.351, 0.798, 0.758, 0.357,
|
| 114 |
+
0.800, 0.749, 0.363, 0.801, 0.740, 0.367, 0.803, 0.731, 0.371, 0.803,
|
| 115 |
+
0.721, 0.375, 0.804, 0.711, 0.378, 0.804, 0.701, 0.380, 0.804, 0.690,
|
| 116 |
+
0.382, 0.804, 0.679, 0.384, 0.803, 0.667, 0.385, 0.802, 0.654, 0.386,
|
| 117 |
+
0.801, 0.642, 0.386, 0.800, 0.629, 0.387, 0.798, 0.615, 0.387, 0.796,
|
| 118 |
+
0.601, 0.387, 0.793, 0.587, 0.387, 0.791, 0.572, 0.387, 0.788, 0.557,
|
| 119 |
+
0.386, 0.785, 0.541, 0.386, 0.781, 0.525, 0.385, 0.778, 0.509, 0.385,
|
| 120 |
+
0.774, 0.492, 0.385, 0.770, 0.475, 0.384, 0.765, 0.457, 0.384, 0.761,
|
| 121 |
+
0.440, 0.384, 0.756, 0.422, 0.384, 0.751, 0.403, 0.384, 0.746, 0.384,
|
| 122 |
+
0.384, 0.741, 0.365, 0.384, 0.735, 0.346, 0.384, 0.730, 0.326, 0.384,
|
| 123 |
+
0.724, 0.305, 0.384, 0.718, 0.284, 0.385, 0.712, 0.263, 0.385, 0.706,
|
| 124 |
+
0.240, 0.386, 0.700, 0.217, 0.386, 0.694, 0.192, 0.387, 0.687, 0.165,
|
| 125 |
+
0.000, 0.680, 0.948, 0.000, 0.687, 0.940, 0.000, 0.693, 0.933, 0.000,
|
| 126 |
+
0.699, 0.925, 0.000, 0.705, 0.918, 0.000, 0.711, 0.912, 0.000, 0.716,
|
| 127 |
+
0.905, 0.000, 0.722, 0.898, 0.050, 0.728, 0.892, 0.109, 0.733, 0.886,
|
| 128 |
+
0.147, 0.738, 0.879, 0.177, 0.743, 0.873, 0.202, 0.748, 0.867, 0.224,
|
| 129 |
+
0.753, 0.861, 0.243, 0.758, 0.855, 0.261, 0.763, 0.849, 0.277, 0.767,
|
| 130 |
+
0.842, 0.292, 0.771, 0.836, 0.305, 0.775, 0.830, 0.318, 0.779, 0.823,
|
| 131 |
+
0.329, 0.783, 0.817, 0.340, 0.787, 0.810, 0.350, 0.790, 0.803, 0.359,
|
| 132 |
+
0.793, 0.796, 0.367, 0.796, 0.789, 0.374, 0.798, 0.782, 0.381, 0.801,
|
| 133 |
+
0.774, 0.387, 0.803, 0.766, 0.393, 0.804, 0.757, 0.397, 0.806, 0.748,
|
| 134 |
+
0.402, 0.807, 0.739, 0.405, 0.808, 0.729, 0.408, 0.809, 0.719, 0.411,
|
| 135 |
+
0.809, 0.709, 0.413, 0.809, 0.698, 0.415, 0.808, 0.687, 0.416, 0.808,
|
| 136 |
+
0.675, 0.417, 0.807, 0.663, 0.417, 0.806, 0.650, 0.417, 0.804, 0.637,
|
| 137 |
+
0.418, 0.802, 0.623, 0.417, 0.800, 0.609, 0.417, 0.798, 0.594, 0.416,
|
| 138 |
+
0.795, 0.579, 0.416, 0.792, 0.564, 0.415, 0.789, 0.548, 0.414, 0.785,
|
| 139 |
+
0.532, 0.414, 0.781, 0.515, 0.413, 0.777, 0.499, 0.412, 0.773, 0.481,
|
| 140 |
+
0.412, 0.769, 0.464, 0.411, 0.764, 0.446, 0.410, 0.759, 0.428, 0.410,
|
| 141 |
+
0.754, 0.409, 0.409, 0.749, 0.390, 0.409, 0.743, 0.371, 0.409, 0.738,
|
| 142 |
+
0.351, 0.409, 0.732, 0.331, 0.408, 0.726, 0.310, 0.408, 0.720, 0.289,
|
| 143 |
+
0.408, 0.714, 0.268, 0.408, 0.708, 0.245, 0.409, 0.702, 0.222, 0.409,
|
| 144 |
+
0.695, 0.197, 0.409, 0.689, 0.170, 0.000, 0.681, 0.950, 0.000, 0.688,
|
| 145 |
+
0.943, 0.000, 0.694, 0.936, 0.000, 0.700, 0.929, 0.000, 0.706, 0.922,
|
| 146 |
+
0.000, 0.712, 0.915, 0.074, 0.718, 0.908, 0.124, 0.724, 0.902, 0.159,
|
| 147 |
+
0.730, 0.896, 0.188, 0.735, 0.890, 0.213, 0.740, 0.884, 0.235, 0.746,
|
| 148 |
+
0.878, 0.255, 0.751, 0.872, 0.273, 0.756, 0.866, 0.289, 0.761, 0.860,
|
| 149 |
+
0.305, 0.766, 0.854, 0.319, 0.770, 0.848, 0.332, 0.775, 0.842, 0.344,
|
| 150 |
+
0.779, 0.836, 0.356, 0.783, 0.830, 0.366, 0.787, 0.823, 0.376, 0.790,
|
| 151 |
+
0.817, 0.385, 0.794, 0.810, 0.394, 0.797, 0.803, 0.401, 0.800, 0.796,
|
| 152 |
+
0.408, 0.802, 0.789, 0.414, 0.805, 0.781, 0.420, 0.807, 0.773, 0.425,
|
| 153 |
+
0.809, 0.765, 0.430, 0.810, 0.756, 0.433, 0.812, 0.747, 0.437, 0.813,
|
| 154 |
+
0.738, 0.440, 0.813, 0.728, 0.442, 0.814, 0.717, 0.444, 0.813, 0.706,
|
| 155 |
+
0.445, 0.813, 0.695, 0.446, 0.812, 0.683, 0.446, 0.811, 0.671, 0.447,
|
| 156 |
+
0.810, 0.658, 0.447, 0.809, 0.645, 0.446, 0.807, 0.631, 0.446, 0.804,
|
| 157 |
+
0.617, 0.445, 0.802, 0.602, 0.444, 0.799, 0.587, 0.443, 0.796, 0.571,
|
| 158 |
+
0.442, 0.792, 0.555, 0.441, 0.789, 0.539, 0.440, 0.785, 0.522, 0.439,
|
| 159 |
+
0.781, 0.505, 0.438, 0.776, 0.488, 0.437, 0.772, 0.470, 0.436, 0.767,
|
| 160 |
+
0.452, 0.435, 0.762, 0.433, 0.435, 0.757, 0.415, 0.434, 0.751, 0.396,
|
| 161 |
+
0.433, 0.746, 0.376, 0.432, 0.740, 0.356, 0.432, 0.734, 0.336, 0.431,
|
| 162 |
+
0.728, 0.315, 0.431, 0.722, 0.294, 0.431, 0.716, 0.272, 0.430, 0.710,
|
| 163 |
+
0.250, 0.430, 0.703, 0.226, 0.430, 0.697, 0.201, 0.430, 0.690, 0.175,
|
| 164 |
+
0.000, 0.682, 0.953, 0.000, 0.689, 0.946, 0.000, 0.695, 0.938, 0.002,
|
| 165 |
+
0.701, 0.932, 0.086, 0.708, 0.925, 0.133, 0.714, 0.918, 0.167, 0.720,
|
| 166 |
+
0.912, 0.196, 0.726, 0.906, 0.221, 0.731, 0.900, 0.243, 0.737, 0.894,
|
| 167 |
+
0.263, 0.743, 0.888, 0.281, 0.748, 0.882, 0.298, 0.753, 0.876, 0.314,
|
| 168 |
+
0.759, 0.870, 0.329, 0.764, 0.865, 0.342, 0.768, 0.859, 0.355, 0.773,
|
| 169 |
+
0.853, 0.368, 0.778, 0.847, 0.379, 0.782, 0.842, 0.390, 0.786, 0.836,
|
| 170 |
+
0.400, 0.790, 0.830, 0.409, 0.794, 0.823, 0.417, 0.798, 0.817, 0.425,
|
| 171 |
+
0.801, 0.810, 0.433, 0.804, 0.803, 0.439, 0.807, 0.796, 0.445, 0.809,
|
| 172 |
+
0.789, 0.451, 0.811, 0.781, 0.456, 0.813, 0.773, 0.460, 0.815, 0.764,
|
| 173 |
+
0.463, 0.816, 0.755, 0.466, 0.817, 0.746, 0.469, 0.818, 0.736, 0.471,
|
| 174 |
+
0.818, 0.725, 0.472, 0.818, 0.715, 0.473, 0.818, 0.703, 0.474, 0.817,
|
| 175 |
+
0.691, 0.474, 0.816, 0.679, 0.474, 0.815, 0.666, 0.474, 0.813, 0.653,
|
| 176 |
+
0.473, 0.811, 0.639, 0.473, 0.809, 0.624, 0.472, 0.806, 0.610, 0.471,
|
| 177 |
+
0.803, 0.594, 0.469, 0.800, 0.579, 0.468, 0.796, 0.562, 0.467, 0.792,
|
| 178 |
+
0.546, 0.466, 0.788, 0.529, 0.464, 0.784, 0.512, 0.463, 0.780, 0.494,
|
| 179 |
+
0.462, 0.775, 0.476, 0.460, 0.770, 0.458, 0.459, 0.765, 0.439, 0.458,
|
| 180 |
+
0.759, 0.420, 0.457, 0.754, 0.401, 0.456, 0.748, 0.381, 0.455, 0.742,
|
| 181 |
+
0.361, 0.454, 0.736, 0.341, 0.453, 0.730, 0.320, 0.453, 0.724, 0.299,
|
| 182 |
+
0.452, 0.718, 0.277, 0.452, 0.711, 0.254, 0.451, 0.705, 0.231, 0.451,
|
| 183 |
+
0.698, 0.206, 0.450, 0.691, 0.179, 0.000, 0.683, 0.955, 0.013, 0.689,
|
| 184 |
+
0.948, 0.092, 0.696, 0.941, 0.137, 0.702, 0.935, 0.171, 0.709, 0.928,
|
| 185 |
+
0.200, 0.715, 0.922, 0.225, 0.721, 0.916, 0.247, 0.727, 0.909, 0.267,
|
| 186 |
+
0.733, 0.904, 0.286, 0.739, 0.898, 0.303, 0.745, 0.892, 0.320, 0.750,
|
| 187 |
+
0.886, 0.335, 0.756, 0.881, 0.350, 0.761, 0.875, 0.363, 0.766, 0.870,
|
| 188 |
+
0.376, 0.771, 0.864, 0.388, 0.776, 0.859, 0.400, 0.781, 0.853, 0.411,
|
| 189 |
+
0.785, 0.847, 0.421, 0.790, 0.842, 0.430, 0.794, 0.836, 0.439, 0.798,
|
| 190 |
+
0.830, 0.448, 0.802, 0.824, 0.455, 0.805, 0.817, 0.462, 0.808, 0.810,
|
| 191 |
+
0.469, 0.811, 0.804, 0.475, 0.814, 0.796, 0.480, 0.816, 0.789, 0.484,
|
| 192 |
+
0.818, 0.781, 0.488, 0.820, 0.772, 0.492, 0.821, 0.763, 0.495, 0.822,
|
| 193 |
+
0.754, 0.497, 0.823, 0.744, 0.499, 0.823, 0.734, 0.500, 0.823, 0.723,
|
| 194 |
+
0.501, 0.823, 0.712, 0.501, 0.822, 0.700, 0.501, 0.821, 0.687, 0.501,
|
| 195 |
+
0.819, 0.674, 0.500, 0.818, 0.661, 0.499, 0.815, 0.647, 0.498, 0.813,
|
| 196 |
+
0.632, 0.497, 0.810, 0.617, 0.496, 0.807, 0.602, 0.494, 0.804, 0.586,
|
| 197 |
+
0.493, 0.800, 0.569, 0.491, 0.796, 0.553, 0.490, 0.792, 0.536, 0.488,
|
| 198 |
+
0.787, 0.518, 0.486, 0.783, 0.500, 0.485, 0.778, 0.482, 0.483, 0.773,
|
| 199 |
+
0.463, 0.482, 0.767, 0.445, 0.480, 0.762, 0.425, 0.479, 0.756, 0.406,
|
| 200 |
+
0.478, 0.750, 0.386, 0.477, 0.744, 0.366, 0.476, 0.738, 0.345, 0.475,
|
| 201 |
+
0.732, 0.325, 0.474, 0.726, 0.303, 0.473, 0.719, 0.281, 0.472, 0.713,
|
| 202 |
+
0.258, 0.471, 0.706, 0.235, 0.470, 0.699, 0.210, 0.469, 0.692, 0.184,
|
| 203 |
+
0.095, 0.683, 0.958, 0.139, 0.690, 0.951, 0.173, 0.697, 0.944, 0.201,
|
| 204 |
+
0.703, 0.938, 0.226, 0.710, 0.931, 0.249, 0.716, 0.925, 0.269, 0.723,
|
| 205 |
+
0.919, 0.288, 0.729, 0.913, 0.306, 0.735, 0.907, 0.323, 0.741, 0.902,
|
| 206 |
+
0.339, 0.747, 0.896, 0.354, 0.752, 0.891, 0.368, 0.758, 0.885, 0.382,
|
| 207 |
+
0.764, 0.880, 0.394, 0.769, 0.875, 0.407, 0.774, 0.869, 0.418, 0.779,
|
| 208 |
+
0.864, 0.429, 0.784, 0.859, 0.440, 0.789, 0.853, 0.450, 0.793, 0.848,
|
| 209 |
+
0.459, 0.798, 0.842, 0.468, 0.802, 0.836, 0.476, 0.806, 0.830, 0.483,
|
| 210 |
+
0.809, 0.824, 0.490, 0.812, 0.818, 0.496, 0.815, 0.811, 0.502, 0.818,
|
| 211 |
+
0.804, 0.507, 0.821, 0.796, 0.512, 0.823, 0.789, 0.515, 0.825, 0.780,
|
| 212 |
+
0.519, 0.826, 0.772, 0.521, 0.827, 0.762, 0.524, 0.828, 0.753, 0.525,
|
| 213 |
+
0.828, 0.742, 0.526, 0.828, 0.732, 0.527, 0.828, 0.720, 0.527, 0.827,
|
| 214 |
+
0.708, 0.527, 0.826, 0.696, 0.526, 0.824, 0.683, 0.525, 0.822, 0.669,
|
| 215 |
+
0.524, 0.820, 0.655, 0.523, 0.817, 0.640, 0.522, 0.814, 0.625, 0.520,
|
| 216 |
+
0.811, 0.609, 0.518, 0.808, 0.593, 0.516, 0.804, 0.576, 0.515, 0.800,
|
| 217 |
+
0.559, 0.513, 0.795, 0.542, 0.511, 0.791, 0.524, 0.509, 0.786, 0.506,
|
| 218 |
+
0.507, 0.781, 0.488, 0.505, 0.775, 0.469, 0.504, 0.770, 0.450, 0.502,
|
| 219 |
+
0.764, 0.431, 0.500, 0.759, 0.411, 0.499, 0.753, 0.391, 0.497, 0.746,
|
| 220 |
+
0.371, 0.496, 0.740, 0.350, 0.495, 0.734, 0.329, 0.494, 0.727, 0.307,
|
| 221 |
+
0.492, 0.721, 0.285, 0.491, 0.714, 0.262, 0.490, 0.707, 0.239, 0.489,
|
| 222 |
+
0.700, 0.214, 0.488, 0.693, 0.188, 0.172, 0.684, 0.961, 0.201, 0.691,
|
| 223 |
+
0.954, 0.226, 0.698, 0.947, 0.248, 0.704, 0.941, 0.269, 0.711, 0.934,
|
| 224 |
+
0.289, 0.717, 0.928, 0.307, 0.724, 0.922, 0.324, 0.730, 0.917, 0.340,
|
| 225 |
+
0.736, 0.911, 0.356, 0.743, 0.906, 0.370, 0.749, 0.900, 0.384, 0.755,
|
| 226 |
+
0.895, 0.398, 0.760, 0.890, 0.411, 0.766, 0.885, 0.423, 0.772, 0.880,
|
| 227 |
+
0.435, 0.777, 0.874, 0.446, 0.782, 0.869, 0.457, 0.787, 0.864, 0.467,
|
| 228 |
+
0.792, 0.859, 0.477, 0.797, 0.854, 0.486, 0.801, 0.848, 0.494, 0.806,
|
| 229 |
+
0.843, 0.502, 0.810, 0.837, 0.510, 0.813, 0.831, 0.517, 0.817, 0.825,
|
| 230 |
+
0.523, 0.820, 0.818, 0.528, 0.823, 0.811, 0.533, 0.825, 0.804, 0.538,
|
| 231 |
+
0.828, 0.797, 0.542, 0.829, 0.788, 0.545, 0.831, 0.780, 0.547, 0.832,
|
| 232 |
+
0.771, 0.549, 0.833, 0.761, 0.551, 0.833, 0.751, 0.552, 0.833, 0.740,
|
| 233 |
+
0.552, 0.833, 0.729, 0.552, 0.832, 0.717, 0.551, 0.830, 0.704, 0.551,
|
| 234 |
+
0.829, 0.691, 0.550, 0.827, 0.677, 0.548, 0.824, 0.663, 0.547, 0.822,
|
| 235 |
+
0.648, 0.545, 0.819, 0.632, 0.543, 0.815, 0.617, 0.541, 0.812, 0.600,
|
| 236 |
+
0.539, 0.808, 0.583, 0.537, 0.803, 0.566, 0.535, 0.799, 0.549, 0.533,
|
| 237 |
+
0.794, 0.531, 0.531, 0.789, 0.512, 0.529, 0.784, 0.494, 0.527, 0.778,
|
| 238 |
+
0.475, 0.525, 0.773, 0.455, 0.523, 0.767, 0.436, 0.521, 0.761, 0.416,
|
| 239 |
+
0.519, 0.755, 0.396, 0.517, 0.748, 0.375, 0.516, 0.742, 0.354, 0.514,
|
| 240 |
+
0.735, 0.333, 0.513, 0.729, 0.311, 0.511, 0.722, 0.289, 0.510, 0.715,
|
| 241 |
+
0.266, 0.509, 0.708, 0.242, 0.507, 0.701, 0.218, 0.506, 0.694, 0.191,
|
| 242 |
+
0.224, 0.684, 0.963, 0.247, 0.691, 0.956, 0.268, 0.698, 0.950, 0.287,
|
| 243 |
+
0.705, 0.943, 0.305, 0.712, 0.937, 0.323, 0.719, 0.931, 0.339, 0.725,
|
| 244 |
+
0.926, 0.355, 0.732, 0.920, 0.370, 0.738, 0.915, 0.385, 0.744, 0.909,
|
| 245 |
+
0.399, 0.751, 0.904, 0.412, 0.757, 0.899, 0.425, 0.763, 0.894, 0.438,
|
| 246 |
+
0.768, 0.889, 0.450, 0.774, 0.884, 0.461, 0.780, 0.879, 0.472, 0.785,
|
| 247 |
+
0.875, 0.483, 0.790, 0.870, 0.493, 0.795, 0.865, 0.502, 0.800, 0.860,
|
| 248 |
+
0.511, 0.805, 0.855, 0.520, 0.809, 0.849, 0.528, 0.814, 0.844, 0.535,
|
| 249 |
+
0.818, 0.838, 0.542, 0.821, 0.832, 0.548, 0.824, 0.826, 0.554, 0.827,
|
| 250 |
+
0.819, 0.559, 0.830, 0.812, 0.563, 0.832, 0.805, 0.567, 0.834, 0.797,
|
| 251 |
+
0.570, 0.836, 0.788, 0.572, 0.837, 0.779, 0.574, 0.838, 0.770, 0.575,
|
| 252 |
+
0.838, 0.760, 0.576, 0.838, 0.749, 0.576, 0.838, 0.737, 0.576, 0.837,
|
| 253 |
+
0.725, 0.575, 0.835, 0.713, 0.574, 0.834, 0.699, 0.573, 0.831, 0.685,
|
| 254 |
+
0.571, 0.829, 0.671, 0.570, 0.826, 0.656, 0.568, 0.823, 0.640, 0.566,
|
| 255 |
+
0.819, 0.624, 0.563, 0.815, 0.607, 0.561, 0.811, 0.590, 0.559, 0.807,
|
| 256 |
+
0.573, 0.556, 0.802, 0.555, 0.554, 0.797, 0.537, 0.552, 0.792, 0.518,
|
| 257 |
+
0.549, 0.786, 0.499, 0.547, 0.781, 0.480, 0.545, 0.775, 0.460, 0.543,
|
| 258 |
+
0.769, 0.441, 0.541, 0.763, 0.420, 0.539, 0.756, 0.400, 0.537, 0.750,
|
| 259 |
+
0.379, 0.535, 0.743, 0.358, 0.533, 0.737, 0.337, 0.531, 0.730, 0.315,
|
| 260 |
+
0.530, 0.723, 0.293, 0.528, 0.716, 0.270, 0.527, 0.709, 0.246, 0.525,
|
| 261 |
+
0.702, 0.221, 0.524, 0.694, 0.195, 0.265, 0.685, 0.965, 0.284, 0.692,
|
| 262 |
+
0.959, 0.303, 0.699, 0.952, 0.320, 0.706, 0.946, 0.337, 0.713, 0.940,
|
| 263 |
+
0.353, 0.720, 0.935, 0.369, 0.726, 0.929, 0.384, 0.733, 0.924, 0.398,
|
| 264 |
+
0.739, 0.918, 0.412, 0.746, 0.913, 0.425, 0.752, 0.908, 0.438, 0.759,
|
| 265 |
+
0.903, 0.451, 0.765, 0.899, 0.463, 0.771, 0.894, 0.475, 0.777, 0.889,
|
| 266 |
+
0.486, 0.782, 0.884, 0.497, 0.788, 0.880, 0.507, 0.793, 0.875, 0.517,
|
| 267 |
+
0.799, 0.870, 0.527, 0.804, 0.866, 0.536, 0.809, 0.861, 0.544, 0.813,
|
| 268 |
+
0.856, 0.552, 0.818, 0.850, 0.560, 0.822, 0.845, 0.566, 0.826, 0.839,
|
| 269 |
+
0.573, 0.829, 0.833, 0.578, 0.832, 0.827, 0.583, 0.835, 0.820, 0.587,
|
| 270 |
+
0.837, 0.813, 0.591, 0.839, 0.805, 0.594, 0.841, 0.797, 0.596, 0.842,
|
| 271 |
+
0.788, 0.598, 0.843, 0.778, 0.599, 0.843, 0.768, 0.600, 0.843, 0.758,
|
| 272 |
+
0.600, 0.843, 0.746, 0.599, 0.842, 0.734, 0.599, 0.840, 0.721, 0.597,
|
| 273 |
+
0.838, 0.708, 0.596, 0.836, 0.694, 0.594, 0.834, 0.679, 0.592, 0.831,
|
| 274 |
+
0.663, 0.590, 0.827, 0.648, 0.587, 0.823, 0.631, 0.585, 0.819, 0.614,
|
| 275 |
+
0.582, 0.815, 0.597, 0.580, 0.810, 0.579, 0.577, 0.805, 0.561, 0.575,
|
| 276 |
+
0.800, 0.542, 0.572, 0.795, 0.524, 0.569, 0.789, 0.504, 0.567, 0.783,
|
| 277 |
+
0.485, 0.565, 0.777, 0.465, 0.562, 0.771, 0.445, 0.560, 0.765, 0.425,
|
| 278 |
+
0.558, 0.758, 0.404, 0.556, 0.752, 0.383, 0.554, 0.745, 0.362, 0.552,
|
| 279 |
+
0.738, 0.341, 0.550, 0.731, 0.319, 0.548, 0.724, 0.296, 0.546, 0.717,
|
| 280 |
+
0.273, 0.544, 0.709, 0.249, 0.542, 0.702, 0.224, 0.541, 0.695, 0.198,
|
| 281 |
+
0.299, 0.685, 0.968, 0.317, 0.692, 0.961, 0.334, 0.699, 0.955, 0.350,
|
| 282 |
+
0.706, 0.949, 0.366, 0.713, 0.943, 0.381, 0.720, 0.938, 0.395, 0.727,
|
| 283 |
+
0.932, 0.410, 0.734, 0.927, 0.423, 0.741, 0.922, 0.437, 0.747, 0.917,
|
| 284 |
+
0.450, 0.754, 0.912, 0.463, 0.760, 0.907, 0.475, 0.767, 0.903, 0.487,
|
| 285 |
+
0.773, 0.898, 0.498, 0.779, 0.894, 0.509, 0.785, 0.889, 0.520, 0.791,
|
| 286 |
+
0.885, 0.531, 0.796, 0.880, 0.540, 0.802, 0.876, 0.550, 0.807, 0.871,
|
| 287 |
+
0.559, 0.812, 0.867, 0.568, 0.817, 0.862, 0.576, 0.822, 0.857, 0.583,
|
| 288 |
+
0.826, 0.852, 0.590, 0.830, 0.847, 0.596, 0.834, 0.841, 0.602, 0.837,
|
| 289 |
+
0.835, 0.607, 0.840, 0.828, 0.611, 0.843, 0.821, 0.615, 0.845, 0.814,
|
| 290 |
+
0.618, 0.846, 0.805, 0.620, 0.848, 0.797, 0.622, 0.848, 0.787, 0.623,
|
| 291 |
+
0.849, 0.777, 0.623, 0.849, 0.766, 0.623, 0.848, 0.755, 0.622, 0.847,
|
| 292 |
+
0.743, 0.621, 0.845, 0.730, 0.620, 0.843, 0.716, 0.618, 0.841, 0.702,
|
| 293 |
+
0.616, 0.838, 0.687, 0.613, 0.835, 0.671, 0.611, 0.831, 0.655, 0.608,
|
| 294 |
+
0.827, 0.638, 0.606, 0.823, 0.621, 0.603, 0.818, 0.604, 0.600, 0.814,
|
| 295 |
+
0.585, 0.597, 0.808, 0.567, 0.594, 0.803, 0.548, 0.592, 0.797, 0.529,
|
| 296 |
+
0.589, 0.792, 0.510, 0.586, 0.785, 0.490, 0.584, 0.779, 0.470, 0.581,
|
| 297 |
+
0.773, 0.450, 0.579, 0.766, 0.429, 0.576, 0.760, 0.408, 0.574, 0.753,
|
| 298 |
+
0.387, 0.572, 0.746, 0.366, 0.569, 0.739, 0.344, 0.567, 0.732, 0.322,
|
| 299 |
+
0.565, 0.725, 0.299, 0.563, 0.717, 0.276, 0.561, 0.710, 0.252, 0.559,
|
| 300 |
+
0.703, 0.227, 0.557, 0.695, 0.201, 0.329, 0.685, 0.970, 0.346, 0.692,
|
| 301 |
+
0.964, 0.362, 0.699, 0.958, 0.377, 0.707, 0.952, 0.392, 0.714, 0.946,
|
| 302 |
+
0.406, 0.721, 0.941, 0.420, 0.728, 0.935, 0.434, 0.735, 0.930, 0.447,
|
| 303 |
+
0.742, 0.925, 0.460, 0.749, 0.920, 0.473, 0.756, 0.916, 0.485, 0.762,
|
| 304 |
+
0.911, 0.497, 0.769, 0.907, 0.509, 0.775, 0.903, 0.521, 0.781, 0.898,
|
| 305 |
+
0.532, 0.788, 0.894, 0.542, 0.794, 0.890, 0.553, 0.799, 0.886, 0.563,
|
| 306 |
+
0.805, 0.882, 0.572, 0.811, 0.877, 0.581, 0.816, 0.873, 0.590, 0.821,
|
| 307 |
+
0.868, 0.598, 0.826, 0.864, 0.606, 0.830, 0.859, 0.613, 0.834, 0.854,
|
| 308 |
+
0.619, 0.838, 0.848, 0.625, 0.842, 0.842, 0.630, 0.845, 0.836, 0.634,
|
| 309 |
+
0.848, 0.829, 0.638, 0.850, 0.822, 0.641, 0.852, 0.814, 0.643, 0.853,
|
| 310 |
+
0.805, 0.645, 0.854, 0.796, 0.645, 0.854, 0.786, 0.646, 0.854, 0.775,
|
| 311 |
+
0.645, 0.853, 0.764, 0.645, 0.852, 0.751, 0.643, 0.851, 0.738, 0.642,
|
| 312 |
+
0.848, 0.725, 0.639, 0.846, 0.710, 0.637, 0.843, 0.695, 0.635, 0.839,
|
| 313 |
+
0.679, 0.632, 0.836, 0.662, 0.629, 0.831, 0.645, 0.626, 0.827, 0.628,
|
| 314 |
+
0.623, 0.822, 0.610, 0.620, 0.817, 0.592, 0.617, 0.811, 0.573, 0.614,
|
| 315 |
+
0.806, 0.554, 0.611, 0.800, 0.534, 0.608, 0.794, 0.515, 0.605, 0.788,
|
| 316 |
+
0.495, 0.602, 0.781, 0.474, 0.599, 0.775, 0.454, 0.597, 0.768, 0.433,
|
| 317 |
+
0.594, 0.761, 0.412, 0.592, 0.754, 0.391, 0.589, 0.747, 0.369, 0.587,
|
| 318 |
+
0.740, 0.347, 0.584, 0.733, 0.325, 0.582, 0.725, 0.302, 0.580, 0.718,
|
| 319 |
+
0.279, 0.577, 0.710, 0.255, 0.575, 0.703, 0.230, 0.573, 0.695, 0.204,
|
| 320 |
+
0.357, 0.685, 0.972, 0.372, 0.692, 0.966, 0.387, 0.700, 0.960, 0.401,
|
| 321 |
+
0.707, 0.954, 0.416, 0.714, 0.949, 0.429, 0.722, 0.943, 0.443, 0.729,
|
| 322 |
+
0.938, 0.456, 0.736, 0.933, 0.469, 0.743, 0.929, 0.482, 0.750, 0.924,
|
| 323 |
+
0.494, 0.757, 0.919, 0.507, 0.764, 0.915, 0.519, 0.771, 0.911, 0.530,
|
| 324 |
+
0.777, 0.907, 0.542, 0.784, 0.903, 0.553, 0.790, 0.899, 0.563, 0.796,
|
| 325 |
+
0.895, 0.574, 0.802, 0.891, 0.584, 0.808, 0.887, 0.593, 0.814, 0.883,
|
| 326 |
+
0.603, 0.820, 0.879, 0.611, 0.825, 0.875, 0.620, 0.830, 0.870, 0.627,
|
| 327 |
+
0.835, 0.866, 0.635, 0.839, 0.861, 0.641, 0.843, 0.856, 0.647, 0.847,
|
| 328 |
+
0.850, 0.652, 0.850, 0.844, 0.657, 0.853, 0.838, 0.660, 0.855, 0.831,
|
| 329 |
+
0.663, 0.857, 0.823, 0.666, 0.859, 0.814, 0.667, 0.859, 0.805, 0.668,
|
| 330 |
+
0.860, 0.795, 0.668, 0.860, 0.784, 0.667, 0.859, 0.773, 0.666, 0.858,
|
| 331 |
+
0.760, 0.665, 0.856, 0.747, 0.663, 0.853, 0.733, 0.661, 0.851, 0.718,
|
| 332 |
+
0.658, 0.847, 0.703, 0.655, 0.844, 0.687, 0.652, 0.840, 0.670, 0.649,
|
| 333 |
+
0.835, 0.652, 0.646, 0.830, 0.635, 0.642, 0.825, 0.616, 0.639, 0.820,
|
| 334 |
+
0.598, 0.636, 0.814, 0.579, 0.633, 0.808, 0.559, 0.629, 0.802, 0.539,
|
| 335 |
+
0.626, 0.796, 0.519, 0.623, 0.790, 0.499, 0.620, 0.783, 0.479, 0.617,
|
| 336 |
+
0.776, 0.458, 0.614, 0.769, 0.437, 0.611, 0.762, 0.416, 0.609, 0.755,
|
| 337 |
+
0.394, 0.606, 0.748, 0.372, 0.603, 0.740, 0.350, 0.601, 0.733, 0.328,
|
| 338 |
+
0.598, 0.726, 0.305, 0.596, 0.718, 0.282, 0.593, 0.710, 0.257, 0.591,
|
| 339 |
+
0.703, 0.232, 0.589, 0.695, 0.206, 0.381, 0.684, 0.974, 0.396, 0.692,
|
| 340 |
+
0.968, 0.410, 0.700, 0.962, 0.424, 0.707, 0.957, 0.438, 0.715, 0.951,
|
| 341 |
+
0.451, 0.722, 0.946, 0.464, 0.729, 0.941, 0.477, 0.737, 0.936, 0.490,
|
| 342 |
+
0.744, 0.932, 0.503, 0.751, 0.927, 0.515, 0.758, 0.923, 0.527, 0.765,
|
| 343 |
+
0.919, 0.539, 0.772, 0.915, 0.550, 0.779, 0.911, 0.562, 0.786, 0.907,
|
| 344 |
+
0.573, 0.792, 0.903, 0.584, 0.799, 0.900, 0.594, 0.805, 0.896, 0.604,
|
| 345 |
+
0.811, 0.892, 0.614, 0.817, 0.889, 0.623, 0.823, 0.885, 0.632, 0.829,
|
| 346 |
+
0.881, 0.641, 0.834, 0.877, 0.649, 0.839, 0.873, 0.656, 0.844, 0.868,
|
| 347 |
+
0.663, 0.848, 0.863, 0.669, 0.852, 0.858, 0.674, 0.855, 0.852, 0.679,
|
| 348 |
+
0.858, 0.846, 0.682, 0.861, 0.839, 0.685, 0.863, 0.832, 0.688, 0.864,
|
| 349 |
+
0.823, 0.689, 0.865, 0.814, 0.690, 0.865, 0.804, 0.690, 0.865, 0.794,
|
| 350 |
+
0.689, 0.864, 0.782, 0.688, 0.863, 0.769, 0.686, 0.861, 0.756, 0.684,
|
| 351 |
+
0.858, 0.742, 0.681, 0.855, 0.726, 0.678, 0.852, 0.711, 0.675, 0.848,
|
| 352 |
+
0.694, 0.672, 0.844, 0.677, 0.668, 0.839, 0.659, 0.665, 0.834, 0.641,
|
| 353 |
+
0.662, 0.829, 0.622, 0.658, 0.823, 0.603, 0.655, 0.817, 0.584, 0.651,
|
| 354 |
+
0.811, 0.564, 0.648, 0.805, 0.544, 0.644, 0.798, 0.524, 0.641, 0.791,
|
| 355 |
+
0.503, 0.638, 0.785, 0.483, 0.635, 0.778, 0.462, 0.631, 0.770, 0.440,
|
| 356 |
+
0.628, 0.763, 0.419, 0.625, 0.756, 0.397, 0.623, 0.748, 0.375, 0.620,
|
| 357 |
+
0.741, 0.353, 0.617, 0.733, 0.330, 0.614, 0.726, 0.307, 0.612, 0.718,
|
| 358 |
+
0.284, 0.609, 0.710, 0.260, 0.606, 0.702, 0.235, 0.604, 0.694, 0.208,
|
| 359 |
+
0.404, 0.684, 0.977, 0.418, 0.692, 0.971, 0.432, 0.699, 0.965, 0.445,
|
| 360 |
+
0.707, 0.959, 0.458, 0.715, 0.954, 0.472, 0.722, 0.949, 0.484, 0.730,
|
| 361 |
+
0.944, 0.497, 0.737, 0.939, 0.510, 0.745, 0.935, 0.522, 0.752, 0.931,
|
| 362 |
+
0.534, 0.759, 0.926, 0.546, 0.767, 0.922, 0.558, 0.774, 0.919, 0.569,
|
| 363 |
+
0.781, 0.915, 0.581, 0.788, 0.911, 0.592, 0.794, 0.908, 0.603, 0.801,
|
| 364 |
+
0.904, 0.613, 0.808, 0.901, 0.624, 0.814, 0.897, 0.633, 0.820, 0.894,
|
| 365 |
+
0.643, 0.826, 0.891, 0.652, 0.832, 0.887, 0.661, 0.838, 0.883, 0.669,
|
| 366 |
+
0.843, 0.879, 0.677, 0.848, 0.875, 0.684, 0.853, 0.871, 0.690, 0.857,
|
| 367 |
+
0.866, 0.695, 0.860, 0.860, 0.700, 0.864, 0.855, 0.704, 0.866, 0.848,
|
| 368 |
+
0.707, 0.869, 0.841, 0.709, 0.870, 0.833, 0.711, 0.871, 0.824, 0.711,
|
| 369 |
+
0.871, 0.814, 0.711, 0.871, 0.803, 0.710, 0.870, 0.791, 0.709, 0.868,
|
| 370 |
+
0.778, 0.707, 0.866, 0.765, 0.704, 0.864, 0.750, 0.701, 0.860, 0.735,
|
| 371 |
+
0.698, 0.857, 0.718, 0.695, 0.852, 0.702, 0.691, 0.848, 0.684, 0.688,
|
| 372 |
+
0.843, 0.666, 0.684, 0.837, 0.647, 0.680, 0.832, 0.628, 0.676, 0.826,
|
| 373 |
+
0.609, 0.673, 0.820, 0.589, 0.669, 0.813, 0.569, 0.665, 0.807, 0.549,
|
| 374 |
+
0.662, 0.800, 0.528, 0.658, 0.793, 0.507, 0.655, 0.786, 0.486, 0.651,
|
| 375 |
+
0.779, 0.465, 0.648, 0.771, 0.444, 0.645, 0.764, 0.422, 0.642, 0.756,
|
| 376 |
+
0.400, 0.639, 0.749, 0.378, 0.636, 0.741, 0.356, 0.633, 0.733, 0.333,
|
| 377 |
+
0.630, 0.726, 0.310, 0.627, 0.718, 0.286, 0.624, 0.710, 0.262, 0.621,
|
| 378 |
+
0.702, 0.237, 0.619, 0.694, 0.210, 0.425, 0.683, 0.979, 0.439, 0.691,
|
| 379 |
+
0.973, 0.452, 0.699, 0.967, 0.465, 0.707, 0.962, 0.478, 0.715, 0.956,
|
| 380 |
+
0.491, 0.722, 0.951, 0.503, 0.730, 0.947, 0.516, 0.738, 0.942, 0.528,
|
| 381 |
+
0.745, 0.938, 0.540, 0.753, 0.934, 0.552, 0.760, 0.930, 0.564, 0.768,
|
| 382 |
+
0.926, 0.576, 0.775, 0.922, 0.588, 0.782, 0.919, 0.599, 0.789, 0.915,
|
| 383 |
+
0.610, 0.797, 0.912, 0.621, 0.803, 0.909, 0.632, 0.810, 0.906, 0.642,
|
| 384 |
+
0.817, 0.902, 0.652, 0.823, 0.899, 0.662, 0.830, 0.896, 0.671, 0.836,
|
| 385 |
+
0.893, 0.680, 0.842, 0.890, 0.689, 0.847, 0.886, 0.697, 0.853, 0.882,
|
| 386 |
+
0.704, 0.857, 0.878, 0.710, 0.862, 0.874, 0.716, 0.866, 0.869, 0.721,
|
| 387 |
+
0.869, 0.863, 0.725, 0.872, 0.857, 0.729, 0.874, 0.850, 0.731, 0.876,
|
| 388 |
+
0.842, 0.732, 0.877, 0.833, 0.733, 0.877, 0.823, 0.732, 0.877, 0.812,
|
| 389 |
+
0.731, 0.876, 0.800, 0.729, 0.874, 0.787, 0.727, 0.872, 0.773, 0.724,
|
| 390 |
+
0.869, 0.759, 0.721, 0.865, 0.743, 0.718, 0.861, 0.726, 0.714, 0.857,
|
| 391 |
+
0.709, 0.710, 0.852, 0.691, 0.706, 0.846, 0.672, 0.702, 0.841, 0.653,
|
| 392 |
+
0.698, 0.835, 0.634, 0.694, 0.828, 0.614, 0.690, 0.822, 0.594, 0.686,
|
| 393 |
+
0.815, 0.574, 0.683, 0.808, 0.553, 0.679, 0.801, 0.532, 0.675, 0.794,
|
| 394 |
+
0.511, 0.672, 0.787, 0.490, 0.668, 0.779, 0.468, 0.665, 0.772, 0.446,
|
| 395 |
+
0.661, 0.764, 0.425, 0.658, 0.757, 0.403, 0.654, 0.749, 0.380, 0.651,
|
| 396 |
+
0.741, 0.358, 0.648, 0.733, 0.335, 0.645, 0.725, 0.312, 0.642, 0.717,
|
| 397 |
+
0.288, 0.639, 0.709, 0.264, 0.636, 0.701, 0.238, 0.633, 0.693, 0.212,
|
| 398 |
+
0.445, 0.682, 0.981, 0.458, 0.691, 0.975, 0.471, 0.699, 0.969, 0.484,
|
| 399 |
+
0.707, 0.964, 0.496, 0.715, 0.959, 0.509, 0.722, 0.954, 0.521, 0.730,
|
| 400 |
+
0.949, 0.534, 0.738, 0.945, 0.546, 0.746, 0.941, 0.558, 0.753, 0.937,
|
| 401 |
+
0.570, 0.761, 0.933, 0.582, 0.769, 0.929, 0.593, 0.776, 0.926, 0.605,
|
| 402 |
+
0.784, 0.922, 0.616, 0.791, 0.919, 0.628, 0.798, 0.916, 0.639, 0.806,
|
| 403 |
+
0.913, 0.649, 0.813, 0.910, 0.660, 0.820, 0.907, 0.670, 0.826, 0.904,
|
| 404 |
+
0.680, 0.833, 0.902, 0.690, 0.839, 0.899, 0.699, 0.846, 0.896, 0.708,
|
| 405 |
+
0.851, 0.893, 0.716, 0.857, 0.889, 0.724, 0.862, 0.885, 0.731, 0.867,
|
| 406 |
+
0.881, 0.737, 0.871, 0.877, 0.742, 0.875, 0.872, 0.746, 0.878, 0.866,
|
| 407 |
+
0.750, 0.880, 0.859, 0.752, 0.882, 0.851, 0.753, 0.883, 0.843, 0.754,
|
| 408 |
+
0.883, 0.833, 0.753, 0.883, 0.822, 0.752, 0.882, 0.810, 0.750, 0.880,
|
| 409 |
+
0.797, 0.747, 0.877, 0.782, 0.744, 0.874, 0.767, 0.740, 0.870, 0.751,
|
| 410 |
+
0.737, 0.866, 0.734, 0.733, 0.861, 0.716, 0.729, 0.855, 0.697, 0.724,
|
| 411 |
+
0.850, 0.678, 0.720, 0.844, 0.659, 0.716, 0.837, 0.639, 0.712, 0.831,
|
| 412 |
+
0.619, 0.708, 0.824, 0.598, 0.704, 0.817, 0.578, 0.699, 0.810, 0.557,
|
| 413 |
+
0.696, 0.803, 0.535, 0.692, 0.795, 0.514, 0.688, 0.788, 0.493, 0.684,
|
| 414 |
+
0.780, 0.471, 0.680, 0.772, 0.449, 0.677, 0.765, 0.427, 0.673, 0.757,
|
| 415 |
+
0.405, 0.670, 0.749, 0.382, 0.666, 0.741, 0.360, 0.663, 0.733, 0.337,
|
| 416 |
+
0.660, 0.725, 0.313, 0.657, 0.716, 0.289, 0.653, 0.708, 0.265, 0.650,
|
| 417 |
+
0.700, 0.240, 0.647, 0.692, 0.213, 0.464, 0.681, 0.982, 0.476, 0.690,
|
| 418 |
+
0.977, 0.489, 0.698, 0.971, 0.501, 0.706, 0.966, 0.514, 0.714, 0.961,
|
| 419 |
+
0.526, 0.722, 0.956, 0.538, 0.730, 0.952, 0.550, 0.738, 0.947, 0.562,
|
| 420 |
+
0.746, 0.943, 0.574, 0.754, 0.939, 0.586, 0.762, 0.936, 0.598, 0.769,
|
| 421 |
+
0.932, 0.610, 0.777, 0.929, 0.621, 0.785, 0.926, 0.633, 0.792, 0.923,
|
| 422 |
+
0.644, 0.800, 0.920, 0.655, 0.807, 0.917, 0.666, 0.815, 0.915, 0.677,
|
| 423 |
+
0.822, 0.912, 0.688, 0.829, 0.909, 0.698, 0.836, 0.907, 0.708, 0.843,
|
| 424 |
+
0.904, 0.717, 0.849, 0.902, 0.727, 0.855, 0.899, 0.735, 0.861, 0.896,
|
| 425 |
+
0.743, 0.867, 0.893, 0.750, 0.872, 0.889, 0.757, 0.877, 0.885, 0.762,
|
| 426 |
+
0.881, 0.880, 0.767, 0.884, 0.875, 0.770, 0.887, 0.868, 0.773, 0.888,
|
| 427 |
+
0.861, 0.774, 0.889, 0.852, 0.774, 0.890, 0.842, 0.774, 0.889, 0.831,
|
| 428 |
+
0.772, 0.888, 0.819, 0.770, 0.885, 0.806, 0.767, 0.883, 0.791, 0.763,
|
| 429 |
+
0.879, 0.775, 0.759, 0.875, 0.759, 0.755, 0.870, 0.741, 0.751, 0.865,
|
| 430 |
+
0.723, 0.747, 0.859, 0.704, 0.742, 0.853, 0.684, 0.738, 0.847, 0.664,
|
| 431 |
+
0.733, 0.840, 0.644, 0.729, 0.833, 0.623, 0.724, 0.826, 0.603, 0.720,
|
| 432 |
+
0.819, 0.581, 0.716, 0.811, 0.560, 0.712, 0.804, 0.539, 0.708, 0.796,
|
| 433 |
+
0.517, 0.704, 0.788, 0.495, 0.700, 0.780, 0.473, 0.696, 0.772, 0.451,
|
| 434 |
+
0.692, 0.764, 0.429, 0.688, 0.756, 0.407, 0.685, 0.748, 0.384, 0.681,
|
| 435 |
+
0.740, 0.361, 0.678, 0.732, 0.338, 0.674, 0.724, 0.315, 0.671, 0.715,
|
| 436 |
+
0.291, 0.667, 0.707, 0.266, 0.664, 0.699, 0.241, 0.661, 0.691, 0.214,
|
| 437 |
+
0.481, 0.680, 0.984, 0.494, 0.689, 0.978, 0.506, 0.697, 0.973, 0.518,
|
| 438 |
+
0.705, 0.968, 0.530, 0.713, 0.963, 0.542, 0.722, 0.958, 0.554, 0.730,
|
| 439 |
+
0.954, 0.566, 0.738, 0.950, 0.578, 0.746, 0.946, 0.590, 0.754, 0.942,
|
| 440 |
+
0.602, 0.762, 0.939, 0.614, 0.770, 0.935, 0.626, 0.778, 0.932, 0.637,
|
| 441 |
+
0.786, 0.929, 0.649, 0.794, 0.926, 0.660, 0.801, 0.924, 0.671, 0.809,
|
| 442 |
+
0.921, 0.683, 0.817, 0.919, 0.694, 0.824, 0.916, 0.704, 0.832, 0.914,
|
| 443 |
+
0.715, 0.839, 0.912, 0.725, 0.846, 0.910, 0.735, 0.853, 0.908, 0.744,
|
| 444 |
+
0.859, 0.905, 0.753, 0.866, 0.903, 0.762, 0.872, 0.900, 0.770, 0.877,
|
| 445 |
+
0.897, 0.776, 0.882, 0.893, 0.782, 0.886, 0.889, 0.787, 0.890, 0.884,
|
| 446 |
+
0.791, 0.893, 0.878, 0.794, 0.895, 0.871, 0.795, 0.896, 0.862, 0.795,
|
| 447 |
+
0.896, 0.852, 0.794, 0.895, 0.841, 0.792, 0.894, 0.829, 0.789, 0.891,
|
| 448 |
+
0.815, 0.786, 0.888, 0.800, 0.782, 0.884, 0.783, 0.778, 0.879, 0.766,
|
| 449 |
+
0.774, 0.874, 0.748, 0.769, 0.868, 0.729, 0.764, 0.862, 0.710, 0.760,
|
| 450 |
+
0.856, 0.690, 0.755, 0.849, 0.669, 0.750, 0.842, 0.649, 0.745, 0.835,
|
| 451 |
+
0.628, 0.741, 0.827, 0.606, 0.736, 0.820, 0.585, 0.732, 0.812, 0.563,
|
| 452 |
+
0.728, 0.804, 0.542, 0.723, 0.796, 0.520, 0.719, 0.788, 0.498, 0.715,
|
| 453 |
+
0.780, 0.475, 0.711, 0.772, 0.453, 0.707, 0.764, 0.431, 0.703, 0.756,
|
| 454 |
+
0.408, 0.699, 0.748, 0.386, 0.696, 0.739, 0.363, 0.692, 0.731, 0.339,
|
| 455 |
+
0.688, 0.723, 0.316, 0.685, 0.714, 0.292, 0.681, 0.706, 0.267, 0.678,
|
| 456 |
+
0.697, 0.242, 0.674, 0.689, 0.215, 0.498, 0.679, 0.986, 0.510, 0.687,
|
| 457 |
+
0.980, 0.522, 0.696, 0.975, 0.534, 0.704, 0.970, 0.546, 0.712, 0.965,
|
| 458 |
+
0.558, 0.721, 0.961, 0.570, 0.729, 0.956, 0.581, 0.737, 0.952, 0.593,
|
| 459 |
+
0.746, 0.948, 0.605, 0.754, 0.945, 0.617, 0.762, 0.941, 0.629, 0.770,
|
| 460 |
+
0.938, 0.640, 0.778, 0.935, 0.652, 0.786, 0.932, 0.664, 0.794, 0.930,
|
| 461 |
+
0.675, 0.802, 0.927, 0.687, 0.810, 0.925, 0.698, 0.818, 0.923, 0.709,
|
| 462 |
+
0.826, 0.921, 0.720, 0.834, 0.919, 0.731, 0.841, 0.917, 0.742, 0.849,
|
| 463 |
+
0.915, 0.752, 0.856, 0.913, 0.762, 0.863, 0.911, 0.771, 0.870, 0.909,
|
| 464 |
+
0.780, 0.876, 0.907, 0.788, 0.882, 0.904, 0.796, 0.887, 0.901, 0.802,
|
| 465 |
+
0.892, 0.897, 0.807, 0.896, 0.893, 0.811, 0.899, 0.887, 0.814, 0.902,
|
| 466 |
+
0.880, 0.815, 0.903, 0.872, 0.815, 0.903, 0.862, 0.814, 0.902, 0.851,
|
| 467 |
+
0.812, 0.900, 0.838, 0.809, 0.897, 0.824, 0.805, 0.893, 0.808, 0.801,
|
| 468 |
+
0.889, 0.791, 0.796, 0.884, 0.774, 0.791, 0.878, 0.755, 0.786, 0.872,
|
| 469 |
+
0.735, 0.781, 0.865, 0.715, 0.776, 0.858, 0.695, 0.771, 0.851, 0.674,
|
| 470 |
+
0.767, 0.844, 0.653, 0.762, 0.836, 0.631, 0.757, 0.829, 0.610, 0.752,
|
| 471 |
+
0.821, 0.588, 0.748, 0.813, 0.566, 0.743, 0.805, 0.544, 0.739, 0.796,
|
| 472 |
+
0.522, 0.734, 0.788, 0.500, 0.730, 0.780, 0.477, 0.726, 0.772, 0.455,
|
| 473 |
+
0.722, 0.763, 0.432, 0.718, 0.755, 0.410, 0.714, 0.746, 0.387, 0.710,
|
| 474 |
+
0.738, 0.364, 0.706, 0.730, 0.340, 0.702, 0.721, 0.317, 0.698, 0.713,
|
| 475 |
+
0.293, 0.694, 0.704, 0.268, 0.691, 0.696, 0.243, 0.687, 0.687, 0.216,
|
| 476 |
+
0.513, 0.677, 0.987, 0.525, 0.686, 0.982, 0.537, 0.694, 0.977, 0.549,
|
| 477 |
+
0.703, 0.972, 0.561, 0.711, 0.967, 0.572, 0.720, 0.962, 0.584, 0.728,
|
| 478 |
+
0.958, 0.596, 0.737, 0.954, 0.608, 0.745, 0.951, 0.619, 0.753, 0.947,
|
| 479 |
+
0.631, 0.762, 0.944, 0.643, 0.770, 0.941, 0.655, 0.778, 0.938, 0.666,
|
| 480 |
+
0.787, 0.935, 0.678, 0.795, 0.933, 0.689, 0.803, 0.930, 0.701, 0.811,
|
| 481 |
+
0.928, 0.713, 0.820, 0.926, 0.724, 0.828, 0.925, 0.735, 0.836, 0.923,
|
| 482 |
+
0.746, 0.844, 0.921, 0.757, 0.852, 0.920, 0.768, 0.859, 0.918, 0.778,
|
| 483 |
+
0.867, 0.917, 0.788, 0.874, 0.915, 0.797, 0.881, 0.913, 0.806, 0.887,
|
| 484 |
+
0.911, 0.814, 0.893, 0.909, 0.821, 0.898, 0.906, 0.827, 0.902, 0.902,
|
| 485 |
+
0.831, 0.906, 0.897, 0.834, 0.908, 0.890, 0.836, 0.910, 0.882, 0.836,
|
| 486 |
+
0.910, 0.873, 0.834, 0.909, 0.861, 0.832, 0.906, 0.848, 0.828, 0.903,
|
| 487 |
+
0.833, 0.824, 0.899, 0.817, 0.819, 0.894, 0.799, 0.814, 0.888, 0.781,
|
| 488 |
+
0.809, 0.882, 0.761, 0.804, 0.875, 0.741, 0.798, 0.868, 0.720, 0.793,
|
| 489 |
+
0.861, 0.699, 0.788, 0.853, 0.678, 0.783, 0.845, 0.656, 0.777, 0.837,
|
| 490 |
+
0.635, 0.772, 0.829, 0.613, 0.768, 0.821, 0.590, 0.763, 0.813, 0.568,
|
| 491 |
+
0.758, 0.804, 0.546, 0.753, 0.796, 0.524, 0.749, 0.788, 0.501, 0.744,
|
| 492 |
+
0.779, 0.479, 0.740, 0.771, 0.456, 0.736, 0.762, 0.433, 0.731, 0.754,
|
| 493 |
+
0.411, 0.727, 0.745, 0.388, 0.723, 0.736, 0.365, 0.719, 0.728, 0.341,
|
| 494 |
+
0.715, 0.719, 0.317, 0.711, 0.711, 0.293, 0.707, 0.702, 0.268, 0.704,
|
| 495 |
+
0.694, 0.243, 0.700, 0.685, 0.216, 0.528, 0.675, 0.989, 0.540, 0.684,
|
| 496 |
+
0.983, 0.551, 0.693, 0.978, 0.563, 0.701, 0.973, 0.575, 0.710, 0.969,
|
| 497 |
+
0.586, 0.718, 0.964, 0.598, 0.727, 0.960, 0.610, 0.736, 0.956, 0.621,
|
| 498 |
+
0.744, 0.953, 0.633, 0.753, 0.949, 0.645, 0.761, 0.946, 0.656, 0.770,
|
| 499 |
+
0.943, 0.668, 0.778, 0.940, 0.680, 0.787, 0.938, 0.691, 0.795, 0.936,
|
| 500 |
+
0.703, 0.804, 0.933, 0.715, 0.812, 0.932, 0.726, 0.821, 0.930, 0.738,
|
| 501 |
+
0.829, 0.928, 0.749, 0.837, 0.927, 0.761, 0.846, 0.926, 0.772, 0.854,
|
| 502 |
+
0.924, 0.783, 0.862, 0.923, 0.794, 0.870, 0.922, 0.804, 0.877, 0.921,
|
| 503 |
+
0.814, 0.885, 0.920, 0.824, 0.892, 0.918, 0.832, 0.898, 0.917, 0.840,
|
| 504 |
+
0.904, 0.914, 0.846, 0.909, 0.911, 0.851, 0.913, 0.906, 0.855, 0.915,
|
| 505 |
+
0.901, 0.856, 0.917, 0.893, 0.856, 0.917, 0.883, 0.854, 0.915, 0.871,
|
| 506 |
+
0.851, 0.913, 0.858, 0.847, 0.909, 0.842, 0.842, 0.904, 0.825, 0.837,
|
| 507 |
+
0.898, 0.806, 0.831, 0.892, 0.787, 0.826, 0.885, 0.767, 0.820, 0.878,
|
| 508 |
+
0.746, 0.814, 0.870, 0.725, 0.809, 0.862, 0.703, 0.803, 0.854, 0.681,
|
| 509 |
+
0.798, 0.846, 0.659, 0.793, 0.838, 0.637, 0.788, 0.829, 0.615, 0.782,
|
| 510 |
+
0.821, 0.592, 0.777, 0.812, 0.570, 0.773, 0.804, 0.548, 0.768, 0.795,
|
| 511 |
+
0.525, 0.763, 0.787, 0.502, 0.758, 0.778, 0.480, 0.754, 0.769, 0.457,
|
| 512 |
+
0.749, 0.761, 0.434, 0.745, 0.752, 0.411, 0.741, 0.743, 0.388, 0.737,
|
| 513 |
+
0.735, 0.365, 0.732, 0.726, 0.342, 0.728, 0.717, 0.318, 0.724, 0.709,
|
| 514 |
+
0.293, 0.720, 0.700, 0.269, 0.716, 0.691, 0.243, 0.712, 0.683, 0.216,
|
| 515 |
+
0.542, 0.673, 0.990, 0.554, 0.682, 0.985, 0.565, 0.691, 0.980, 0.577,
|
| 516 |
+
0.700, 0.975, 0.588, 0.708, 0.970, 0.600, 0.717, 0.966, 0.611, 0.726,
|
| 517 |
+
0.962, 0.623, 0.734, 0.958, 0.634, 0.743, 0.955, 0.646, 0.752, 0.951,
|
| 518 |
+
0.657, 0.760, 0.948, 0.669, 0.769, 0.945, 0.681, 0.778, 0.943, 0.692,
|
| 519 |
+
0.786, 0.940, 0.704, 0.795, 0.938, 0.716, 0.804, 0.936, 0.728, 0.812,
|
| 520 |
+
0.934, 0.739, 0.821, 0.933, 0.751, 0.830, 0.932, 0.763, 0.838, 0.930,
|
| 521 |
+
0.774, 0.847, 0.929, 0.786, 0.856, 0.929, 0.797, 0.864, 0.928, 0.809,
|
| 522 |
+
0.873, 0.927, 0.819, 0.881, 0.927, 0.830, 0.889, 0.926, 0.840, 0.896,
|
| 523 |
+
0.925, 0.850, 0.903, 0.924, 0.858, 0.910, 0.922, 0.865, 0.915, 0.920,
|
| 524 |
+
0.871, 0.920, 0.916, 0.875, 0.923, 0.911, 0.876, 0.924, 0.903, 0.876,
|
| 525 |
+
0.924, 0.894, 0.873, 0.922, 0.882, 0.870, 0.919, 0.867, 0.865, 0.914,
|
| 526 |
+
0.851, 0.860, 0.909, 0.832, 0.854, 0.902, 0.813, 0.848, 0.895, 0.793,
|
| 527 |
+
0.842, 0.888, 0.772, 0.836, 0.880, 0.750, 0.830, 0.872, 0.729, 0.824,
|
| 528 |
+
0.864, 0.707, 0.819, 0.855, 0.684, 0.813, 0.847, 0.662, 0.808, 0.838,
|
| 529 |
+
0.639, 0.802, 0.829, 0.617, 0.797, 0.820, 0.594, 0.792, 0.812, 0.571,
|
| 530 |
+
0.787, 0.803, 0.549, 0.782, 0.794, 0.526, 0.777, 0.785, 0.503, 0.772,
|
| 531 |
+
0.776, 0.480, 0.767, 0.768, 0.458, 0.763, 0.759, 0.435, 0.758, 0.750,
|
| 532 |
+
0.412, 0.754, 0.741, 0.388, 0.749, 0.732, 0.365, 0.745, 0.724, 0.342,
|
| 533 |
+
0.741, 0.715, 0.318, 0.737, 0.706, 0.293, 0.732, 0.697, 0.269, 0.728,
|
| 534 |
+
0.689, 0.243, 0.724, 0.680, 0.216, 0.556, 0.671, 0.992, 0.567, 0.680,
|
| 535 |
+
0.986, 0.578, 0.689, 0.981, 0.590, 0.697, 0.976, 0.601, 0.706, 0.972,
|
| 536 |
+
0.612, 0.715, 0.968, 0.624, 0.724, 0.964, 0.635, 0.733, 0.960, 0.646,
|
| 537 |
+
0.741, 0.956, 0.658, 0.750, 0.953, 0.670, 0.759, 0.950, 0.681, 0.768,
|
| 538 |
+
0.947, 0.693, 0.777, 0.945, 0.704, 0.786, 0.943, 0.716, 0.794, 0.941,
|
| 539 |
+
0.728, 0.803, 0.939, 0.740, 0.812, 0.937, 0.752, 0.821, 0.936, 0.763,
|
| 540 |
+
0.830, 0.935, 0.775, 0.839, 0.934, 0.787, 0.848, 0.933, 0.799, 0.857,
|
| 541 |
+
0.932, 0.811, 0.866, 0.932, 0.822, 0.875, 0.932, 0.834, 0.883, 0.932,
|
| 542 |
+
0.845, 0.892, 0.931, 0.856, 0.900, 0.931, 0.866, 0.908, 0.931, 0.876,
|
| 543 |
+
0.915, 0.930, 0.884, 0.922, 0.929, 0.890, 0.927, 0.926, 0.895, 0.930,
|
| 544 |
+
0.921, 0.896, 0.932, 0.914, 0.896, 0.932, 0.905, 0.893, 0.929, 0.892,
|
| 545 |
+
0.888, 0.925, 0.876, 0.883, 0.920, 0.859, 0.877, 0.913, 0.840, 0.871,
|
| 546 |
+
0.906, 0.819, 0.864, 0.898, 0.798, 0.858, 0.890, 0.776, 0.852, 0.882,
|
| 547 |
+
0.754, 0.845, 0.873, 0.732, 0.839, 0.864, 0.709, 0.833, 0.855, 0.686,
|
| 548 |
+
0.828, 0.846, 0.664, 0.822, 0.837, 0.641, 0.816, 0.828, 0.618, 0.811,
|
| 549 |
+
0.819, 0.595, 0.806, 0.810, 0.572, 0.800, 0.801, 0.549, 0.795, 0.792,
|
| 550 |
+
0.526, 0.790, 0.783, 0.504, 0.785, 0.774, 0.481, 0.781, 0.765, 0.458,
|
| 551 |
+
0.776, 0.756, 0.435, 0.771, 0.748, 0.412, 0.766, 0.739, 0.388, 0.762,
|
| 552 |
+
0.730, 0.365, 0.757, 0.721, 0.341, 0.753, 0.712, 0.318, 0.749, 0.703,
|
| 553 |
+
0.293, 0.744, 0.695, 0.268, 0.740, 0.686, 0.243, 0.736, 0.677, 0.216,
|
| 554 |
+
0.569, 0.668, 0.993, 0.580, 0.677, 0.987, 0.591, 0.686, 0.982, 0.602,
|
| 555 |
+
0.695, 0.978, 0.613, 0.704, 0.973, 0.624, 0.713, 0.969, 0.635, 0.722,
|
| 556 |
+
0.965, 0.647, 0.731, 0.961, 0.658, 0.740, 0.958, 0.670, 0.748, 0.955,
|
| 557 |
+
0.681, 0.757, 0.952, 0.693, 0.766, 0.949, 0.704, 0.775, 0.947, 0.716,
|
| 558 |
+
0.784, 0.945, 0.728, 0.793, 0.943, 0.739, 0.802, 0.941, 0.751, 0.812,
|
| 559 |
+
0.939, 0.763, 0.821, 0.938, 0.775, 0.830, 0.937, 0.787, 0.839, 0.936,
|
| 560 |
+
0.799, 0.848, 0.936, 0.811, 0.858, 0.936, 0.823, 0.867, 0.935, 0.835,
|
| 561 |
+
0.876, 0.936, 0.847, 0.886, 0.936, 0.859, 0.895, 0.936, 0.870, 0.904,
|
| 562 |
+
0.937, 0.882, 0.912, 0.937, 0.892, 0.920, 0.937, 0.901, 0.928, 0.937,
|
| 563 |
+
0.909, 0.934, 0.936, 0.914, 0.938, 0.932, 0.917, 0.940, 0.926, 0.915,
|
| 564 |
+
0.940, 0.916, 0.912, 0.936, 0.902, 0.906, 0.931, 0.885, 0.900, 0.925,
|
| 565 |
+
0.866, 0.893, 0.917, 0.846, 0.887, 0.909, 0.824, 0.880, 0.900, 0.802,
|
| 566 |
+
0.873, 0.891, 0.780, 0.867, 0.882, 0.757, 0.860, 0.873, 0.734, 0.854,
|
| 567 |
+
0.864, 0.711, 0.848, 0.855, 0.688, 0.842, 0.845, 0.665, 0.836, 0.836,
|
| 568 |
+
0.642, 0.830, 0.827, 0.619, 0.824, 0.818, 0.596, 0.819, 0.808, 0.573,
|
| 569 |
+
0.814, 0.799, 0.549, 0.808, 0.790, 0.527, 0.803, 0.781, 0.504, 0.798,
|
| 570 |
+
0.772, 0.481, 0.793, 0.763, 0.458, 0.788, 0.754, 0.434, 0.783, 0.745,
|
| 571 |
+
0.411, 0.779, 0.736, 0.388, 0.774, 0.727, 0.365, 0.769, 0.718, 0.341,
|
| 572 |
+
0.765, 0.709, 0.317, 0.760, 0.700, 0.293, 0.756, 0.691, 0.268, 0.751,
|
| 573 |
+
0.683, 0.242, 0.747, 0.674, 0.215, 0.581, 0.665, 0.994, 0.592, 0.674,
|
| 574 |
+
0.989, 0.603, 0.683, 0.984, 0.614, 0.692, 0.979, 0.625, 0.701, 0.974,
|
| 575 |
+
0.636, 0.710, 0.970, 0.647, 0.719, 0.966, 0.658, 0.728, 0.963, 0.669,
|
| 576 |
+
0.737, 0.959, 0.681, 0.746, 0.956, 0.692, 0.755, 0.953, 0.703, 0.765,
|
| 577 |
+
0.951, 0.715, 0.774, 0.948, 0.727, 0.783, 0.946, 0.738, 0.792, 0.944,
|
| 578 |
+
0.750, 0.801, 0.943, 0.762, 0.810, 0.941, 0.774, 0.820, 0.940, 0.786,
|
| 579 |
+
0.829, 0.939, 0.798, 0.839, 0.939, 0.810, 0.848, 0.938, 0.822, 0.858,
|
| 580 |
+
0.938, 0.834, 0.867, 0.939, 0.847, 0.877, 0.939, 0.859, 0.887, 0.940,
|
| 581 |
+
0.871, 0.897, 0.940, 0.883, 0.906, 0.942, 0.896, 0.916, 0.943, 0.907,
|
| 582 |
+
0.925, 0.944, 0.918, 0.933, 0.945, 0.927, 0.941, 0.945, 0.934, 0.946,
|
| 583 |
+
0.943, 0.937, 0.949, 0.937, 0.935, 0.948, 0.927, 0.930, 0.943, 0.912,
|
| 584 |
+
0.924, 0.937, 0.893, 0.916, 0.929, 0.872, 0.909, 0.920, 0.850, 0.902,
|
| 585 |
+
0.911, 0.828, 0.895, 0.901, 0.805, 0.888, 0.892, 0.782, 0.881, 0.882,
|
| 586 |
+
0.759, 0.874, 0.872, 0.735, 0.868, 0.863, 0.712, 0.861, 0.853, 0.689,
|
| 587 |
+
0.855, 0.844, 0.665, 0.849, 0.834, 0.642, 0.843, 0.825, 0.619, 0.838,
|
| 588 |
+
0.815, 0.596, 0.832, 0.806, 0.572, 0.826, 0.797, 0.549, 0.821, 0.787,
|
| 589 |
+
0.526, 0.816, 0.778, 0.503, 0.811, 0.769, 0.480, 0.805, 0.760, 0.457,
|
| 590 |
+
0.800, 0.751, 0.434, 0.795, 0.742, 0.411, 0.791, 0.733, 0.387, 0.786,
|
| 591 |
+
0.724, 0.364, 0.781, 0.715, 0.340, 0.776, 0.706, 0.316, 0.772, 0.697,
|
| 592 |
+
0.292, 0.767, 0.688, 0.267, 0.762, 0.679, 0.241, 0.758, 0.670, 0.215,
|
| 593 |
+
0.593, 0.662, 0.995, 0.603, 0.671, 0.990, 0.614, 0.680, 0.985, 0.625,
|
| 594 |
+
0.689, 0.980, 0.636, 0.699, 0.975, 0.647, 0.708, 0.971, 0.658, 0.717,
|
| 595 |
+
0.967, 0.669, 0.726, 0.964, 0.680, 0.735, 0.960, 0.691, 0.744, 0.957,
|
| 596 |
+
0.702, 0.753, 0.955, 0.714, 0.762, 0.952, 0.725, 0.771, 0.950, 0.737,
|
| 597 |
+
0.781, 0.948, 0.748, 0.790, 0.946, 0.760, 0.799, 0.944, 0.772, 0.809,
|
| 598 |
+
0.943, 0.784, 0.818, 0.942, 0.796, 0.828, 0.941, 0.808, 0.837, 0.941,
|
| 599 |
+
0.820, 0.847, 0.940, 0.832, 0.857, 0.941, 0.844, 0.867, 0.941, 0.857,
|
| 600 |
+
0.877, 0.942, 0.869, 0.887, 0.943, 0.882, 0.897, 0.944, 0.895, 0.908,
|
| 601 |
+
0.945, 0.908, 0.918, 0.947, 0.920, 0.928, 0.949, 0.933, 0.938, 0.951,
|
| 602 |
+
0.944, 0.947, 0.953, 0.953, 0.955, 0.954, 0.957, 0.958, 0.950, 0.954,
|
| 603 |
+
0.956, 0.938, 0.948, 0.949, 0.920, 0.940, 0.941, 0.899, 0.932, 0.931,
|
| 604 |
+
0.877, 0.924, 0.921, 0.854, 0.916, 0.911, 0.830, 0.909, 0.901, 0.807,
|
| 605 |
+
0.901, 0.891, 0.783, 0.894, 0.881, 0.759, 0.887, 0.871, 0.736, 0.881,
|
| 606 |
+
0.861, 0.712, 0.874, 0.851, 0.688, 0.868, 0.841, 0.665, 0.862, 0.832,
|
| 607 |
+
0.642, 0.856, 0.822, 0.618, 0.850, 0.812, 0.595, 0.844, 0.803, 0.572,
|
| 608 |
+
0.839, 0.793, 0.549, 0.833, 0.784, 0.525, 0.828, 0.775, 0.502, 0.822,
|
| 609 |
+
0.766, 0.479, 0.817, 0.756, 0.456, 0.812, 0.747, 0.433, 0.807, 0.738,
|
| 610 |
+
0.410, 0.802, 0.729, 0.387, 0.797, 0.720, 0.363, 0.792, 0.711, 0.339,
|
| 611 |
+
0.787, 0.702, 0.315, 0.782, 0.693, 0.291, 0.778, 0.684, 0.266, 0.773,
|
| 612 |
+
0.675, 0.240, 0.768, 0.666, 0.214, 0.604, 0.659, 0.996, 0.614, 0.668,
|
| 613 |
+
0.990, 0.625, 0.677, 0.985, 0.636, 0.686, 0.981, 0.646, 0.695, 0.976,
|
| 614 |
+
0.657, 0.704, 0.972, 0.668, 0.714, 0.968, 0.679, 0.723, 0.965, 0.690,
|
| 615 |
+
0.732, 0.961, 0.701, 0.741, 0.958, 0.712, 0.750, 0.956, 0.723, 0.759,
|
| 616 |
+
0.953, 0.735, 0.769, 0.951, 0.746, 0.778, 0.949, 0.758, 0.787, 0.947,
|
| 617 |
+
0.769, 0.797, 0.945, 0.781, 0.806, 0.944, 0.793, 0.816, 0.943, 0.805,
|
| 618 |
+
0.826, 0.943, 0.817, 0.836, 0.942, 0.829, 0.845, 0.942, 0.841, 0.855,
|
| 619 |
+
0.942, 0.853, 0.866, 0.943, 0.866, 0.876, 0.943, 0.879, 0.886, 0.945,
|
| 620 |
+
0.892, 0.897, 0.946, 0.905, 0.907, 0.948, 0.918, 0.918, 0.950, 0.931,
|
| 621 |
+
0.930, 0.953, 0.945, 0.941, 0.956, 0.958, 0.952, 0.960, 0.971, 0.963,
|
| 622 |
+
0.963, 0.978, 0.968, 0.963, 0.972, 0.963, 0.948, 0.963, 0.954, 0.926,
|
| 623 |
+
0.954, 0.943, 0.903, 0.945, 0.931, 0.879, 0.937, 0.921, 0.855, 0.929,
|
| 624 |
+
0.910, 0.831, 0.921, 0.899, 0.807, 0.914, 0.889, 0.783, 0.907, 0.878,
|
| 625 |
+
0.759, 0.900, 0.868, 0.735, 0.893, 0.858, 0.711, 0.887, 0.848, 0.688,
|
| 626 |
+
0.880, 0.838, 0.664, 0.874, 0.828, 0.641, 0.868, 0.818, 0.617, 0.862,
|
| 627 |
+
0.809, 0.594, 0.856, 0.799, 0.571, 0.850, 0.790, 0.547, 0.845, 0.780,
|
| 628 |
+
0.524, 0.839, 0.771, 0.501, 0.834, 0.762, 0.478, 0.828, 0.752, 0.455,
|
| 629 |
+
0.823, 0.743, 0.432, 0.818, 0.734, 0.409, 0.813, 0.725, 0.385, 0.808,
|
| 630 |
+
0.716, 0.362, 0.803, 0.707, 0.338, 0.798, 0.698, 0.314, 0.793, 0.689,
|
| 631 |
+
0.290, 0.788, 0.680, 0.265, 0.783, 0.671, 0.239, 0.778, 0.662, 0.213,
|
| 632 |
+
0.615, 0.655, 0.996, 0.625, 0.664, 0.991, 0.635, 0.673, 0.986, 0.646,
|
| 633 |
+
0.683, 0.982, 0.656, 0.692, 0.977, 0.667, 0.701, 0.973, 0.678, 0.710,
|
| 634 |
+
0.969, 0.688, 0.719, 0.966, 0.699, 0.729, 0.962, 0.710, 0.738, 0.959,
|
| 635 |
+
0.721, 0.747, 0.956, 0.732, 0.756, 0.954, 0.744, 0.766, 0.952, 0.755,
|
| 636 |
+
0.775, 0.950, 0.766, 0.784, 0.948, 0.778, 0.794, 0.946, 0.789, 0.804,
|
| 637 |
+
0.945, 0.801, 0.813, 0.944, 0.813, 0.823, 0.943, 0.825, 0.833, 0.943,
|
| 638 |
+
0.837, 0.843, 0.943, 0.849, 0.853, 0.943, 0.861, 0.863, 0.944, 0.874,
|
| 639 |
+
0.873, 0.944, 0.886, 0.884, 0.946, 0.899, 0.895, 0.947, 0.912, 0.906,
|
| 640 |
+
0.949, 0.926, 0.917, 0.952, 0.939, 0.928, 0.955, 0.953, 0.940, 0.958,
|
| 641 |
+
0.967, 0.953, 0.963, 0.982, 0.966, 0.969, 0.994, 0.976, 0.972, 0.986,
|
| 642 |
+
0.966, 0.952, 0.976, 0.953, 0.928, 0.966, 0.941, 0.903, 0.957, 0.929,
|
| 643 |
+
0.878, 0.949, 0.918, 0.854, 0.941, 0.906, 0.830, 0.933, 0.896, 0.806,
|
| 644 |
+
0.926, 0.885, 0.782, 0.918, 0.874, 0.758, 0.911, 0.864, 0.734, 0.905,
|
| 645 |
+
0.854, 0.710, 0.898, 0.844, 0.686, 0.892, 0.834, 0.663, 0.885, 0.824,
|
| 646 |
+
0.639, 0.879, 0.814, 0.616, 0.873, 0.804, 0.592, 0.867, 0.795, 0.569,
|
| 647 |
+
0.861, 0.785, 0.546, 0.856, 0.776, 0.523, 0.850, 0.766, 0.500, 0.845,
|
| 648 |
+
0.757, 0.477, 0.839, 0.748, 0.454, 0.834, 0.739, 0.430, 0.829, 0.729,
|
| 649 |
+
0.407, 0.823, 0.720, 0.384, 0.818, 0.711, 0.361, 0.813, 0.702, 0.337,
|
| 650 |
+
0.808, 0.693, 0.313, 0.803, 0.684, 0.289, 0.798, 0.675, 0.264, 0.793,
|
| 651 |
+
0.666, 0.238, 0.788, 0.657, 0.211, 0.625, 0.651, 0.997, 0.635, 0.660,
|
| 652 |
+
0.992, 0.645, 0.669, 0.987, 0.656, 0.679, 0.982, 0.666, 0.688, 0.978,
|
| 653 |
+
0.676, 0.697, 0.974, 0.687, 0.706, 0.970, 0.698, 0.716, 0.966, 0.708,
|
| 654 |
+
0.725, 0.963, 0.719, 0.734, 0.960, 0.730, 0.743, 0.957, 0.741, 0.753,
|
| 655 |
+
0.954, 0.752, 0.762, 0.952, 0.763, 0.771, 0.950, 0.774, 0.781, 0.948,
|
| 656 |
+
0.786, 0.790, 0.947, 0.797, 0.800, 0.945, 0.809, 0.810, 0.945, 0.820,
|
| 657 |
+
0.819, 0.944, 0.832, 0.829, 0.943, 0.844, 0.839, 0.943, 0.856, 0.849,
|
| 658 |
+
0.943, 0.868, 0.860, 0.944, 0.880, 0.870, 0.945, 0.893, 0.880, 0.946,
|
| 659 |
+
0.905, 0.891, 0.947, 0.918, 0.902, 0.949, 0.931, 0.913, 0.951, 0.944,
|
| 660 |
+
0.924, 0.954, 0.957, 0.936, 0.957, 0.971, 0.947, 0.961, 0.983, 0.958,
|
| 661 |
+
0.964, 0.991, 0.963, 0.962, 0.990, 0.957, 0.946, 0.983, 0.946, 0.924,
|
| 662 |
+
0.975, 0.935, 0.900, 0.967, 0.923, 0.876, 0.959, 0.912, 0.851, 0.951,
|
| 663 |
+
0.901, 0.827, 0.943, 0.890, 0.803, 0.936, 0.880, 0.779, 0.929, 0.869,
|
| 664 |
+
0.755, 0.922, 0.859, 0.732, 0.915, 0.849, 0.708, 0.909, 0.839, 0.684,
|
| 665 |
+
0.902, 0.829, 0.661, 0.896, 0.819, 0.637, 0.890, 0.809, 0.614, 0.884,
|
| 666 |
+
0.800, 0.591, 0.878, 0.790, 0.567, 0.872, 0.780, 0.544, 0.866, 0.771,
|
| 667 |
+
0.521, 0.861, 0.762, 0.498, 0.855, 0.752, 0.475, 0.850, 0.743, 0.452,
|
| 668 |
+
0.844, 0.734, 0.429, 0.839, 0.725, 0.406, 0.834, 0.715, 0.382, 0.828,
|
| 669 |
+
0.706, 0.359, 0.823, 0.697, 0.335, 0.818, 0.688, 0.311, 0.813, 0.679,
|
| 670 |
+
0.287, 0.808, 0.670, 0.262, 0.803, 0.662, 0.236, 0.798, 0.653, 0.210,
|
| 671 |
+
0.635, 0.646, 0.998, 0.645, 0.656, 0.992, 0.655, 0.665, 0.987, 0.665,
|
| 672 |
+
0.674, 0.983, 0.675, 0.684, 0.978, 0.685, 0.693, 0.974, 0.696, 0.702,
|
| 673 |
+
0.970, 0.706, 0.711, 0.966, 0.717, 0.721, 0.963, 0.727, 0.730, 0.960,
|
| 674 |
+
0.738, 0.739, 0.957, 0.749, 0.748, 0.955, 0.760, 0.758, 0.952, 0.771,
|
| 675 |
+
0.767, 0.950, 0.782, 0.777, 0.948, 0.793, 0.786, 0.947, 0.804, 0.796,
|
| 676 |
+
0.946, 0.816, 0.805, 0.945, 0.827, 0.815, 0.944, 0.839, 0.825, 0.943,
|
| 677 |
+
0.850, 0.835, 0.943, 0.862, 0.845, 0.943, 0.874, 0.855, 0.943, 0.886,
|
| 678 |
+
0.865, 0.944, 0.898, 0.875, 0.945, 0.910, 0.886, 0.946, 0.923, 0.896,
|
| 679 |
+
0.948, 0.935, 0.907, 0.949, 0.947, 0.917, 0.951, 0.959, 0.927, 0.953,
|
| 680 |
+
0.970, 0.937, 0.955, 0.980, 0.944, 0.955, 0.987, 0.946, 0.949, 0.989,
|
| 681 |
+
0.942, 0.936, 0.985, 0.935, 0.916, 0.980, 0.925, 0.894, 0.973, 0.915,
|
| 682 |
+
0.871, 0.966, 0.904, 0.847, 0.959, 0.894, 0.824, 0.952, 0.883, 0.800,
|
| 683 |
+
0.945, 0.873, 0.776, 0.938, 0.863, 0.752, 0.932, 0.853, 0.729, 0.925,
|
| 684 |
+
0.843, 0.705, 0.919, 0.833, 0.682, 0.912, 0.823, 0.658, 0.906, 0.813,
|
| 685 |
+
0.635, 0.900, 0.803, 0.611, 0.894, 0.794, 0.588, 0.888, 0.784, 0.565,
|
| 686 |
+
0.882, 0.775, 0.542, 0.876, 0.765, 0.519, 0.871, 0.756, 0.496, 0.865,
|
| 687 |
+
0.747, 0.473, 0.859, 0.738, 0.450, 0.854, 0.728, 0.427, 0.848, 0.719,
|
| 688 |
+
0.404, 0.843, 0.710, 0.380, 0.838, 0.701, 0.357, 0.833, 0.692, 0.333,
|
| 689 |
+
0.827, 0.683, 0.310, 0.822, 0.674, 0.285, 0.817, 0.665, 0.260, 0.812,
|
| 690 |
+
0.656, 0.235, 0.807, 0.648, 0.208, 0.644, 0.642, 0.998, 0.654, 0.651,
|
| 691 |
+
0.993, 0.664, 0.660, 0.988, 0.674, 0.670, 0.983, 0.684, 0.679, 0.978,
|
| 692 |
+
0.694, 0.688, 0.974, 0.704, 0.697, 0.970, 0.715, 0.707, 0.967, 0.725,
|
| 693 |
+
0.716, 0.963, 0.735, 0.725, 0.960, 0.746, 0.735, 0.957, 0.757, 0.744,
|
| 694 |
+
0.955, 0.767, 0.753, 0.952, 0.778, 0.763, 0.950, 0.789, 0.772, 0.948,
|
| 695 |
+
0.800, 0.781, 0.947, 0.811, 0.791, 0.945, 0.822, 0.801, 0.944, 0.833,
|
| 696 |
+
0.810, 0.943, 0.845, 0.820, 0.943, 0.856, 0.830, 0.942, 0.868, 0.839,
|
| 697 |
+
0.942, 0.879, 0.849, 0.942, 0.891, 0.859, 0.943, 0.902, 0.869, 0.943,
|
| 698 |
+
0.914, 0.879, 0.944, 0.926, 0.889, 0.945, 0.937, 0.899, 0.946, 0.949,
|
| 699 |
+
0.908, 0.947, 0.959, 0.917, 0.948, 0.969, 0.924, 0.947, 0.978, 0.929,
|
| 700 |
+
0.944, 0.984, 0.930, 0.937, 0.986, 0.927, 0.924, 0.986, 0.921, 0.907,
|
| 701 |
+
0.982, 0.913, 0.887, 0.978, 0.904, 0.865, 0.972, 0.895, 0.842, 0.966,
|
| 702 |
+
0.885, 0.819, 0.959, 0.875, 0.795, 0.953, 0.865, 0.772, 0.946, 0.855,
|
| 703 |
+
0.749, 0.940, 0.846, 0.725, 0.934, 0.836, 0.702, 0.927, 0.826, 0.678,
|
| 704 |
+
0.921, 0.816, 0.655, 0.915, 0.807, 0.632, 0.909, 0.797, 0.609, 0.903,
|
| 705 |
+
0.788, 0.586, 0.897, 0.778, 0.562, 0.891, 0.769, 0.539, 0.886, 0.759,
|
| 706 |
+
0.516, 0.880, 0.750, 0.493, 0.874, 0.741, 0.471, 0.869, 0.732, 0.448,
|
| 707 |
+
0.863, 0.723, 0.425, 0.858, 0.713, 0.402, 0.852, 0.704, 0.378, 0.847,
|
| 708 |
+
0.695, 0.355, 0.842, 0.686, 0.331, 0.836, 0.677, 0.308, 0.831, 0.669,
|
| 709 |
+
0.283, 0.826, 0.660, 0.258, 0.821, 0.651, 0.233, 0.815, 0.642, 0.206,
|
| 710 |
+
0.653, 0.636, 0.998, 0.663, 0.646, 0.993, 0.673, 0.655, 0.988, 0.682,
|
| 711 |
+
0.665, 0.983, 0.692, 0.674, 0.979, 0.702, 0.683, 0.974, 0.712, 0.692,
|
| 712 |
+
0.970, 0.722, 0.702, 0.967, 0.733, 0.711, 0.963, 0.743, 0.720, 0.960,
|
| 713 |
+
0.753, 0.730, 0.957, 0.764, 0.739, 0.954, 0.774, 0.748, 0.952, 0.785,
|
| 714 |
+
0.757, 0.950, 0.796, 0.767, 0.948, 0.806, 0.776, 0.946, 0.817, 0.786,
|
| 715 |
+
0.945, 0.828, 0.795, 0.943, 0.839, 0.804, 0.942, 0.850, 0.814, 0.941,
|
| 716 |
+
0.861, 0.824, 0.941, 0.872, 0.833, 0.940, 0.884, 0.843, 0.940, 0.895,
|
| 717 |
+
0.852, 0.940, 0.906, 0.862, 0.940, 0.917, 0.871, 0.941, 0.928, 0.880,
|
| 718 |
+
0.941, 0.939, 0.889, 0.941, 0.949, 0.897, 0.941, 0.959, 0.904, 0.940,
|
| 719 |
+
0.968, 0.910, 0.938, 0.975, 0.914, 0.933, 0.981, 0.914, 0.925, 0.984,
|
| 720 |
+
0.912, 0.913, 0.985, 0.907, 0.897, 0.983, 0.900, 0.878, 0.980, 0.893,
|
| 721 |
+
0.857, 0.976, 0.884, 0.836, 0.971, 0.875, 0.813, 0.965, 0.866, 0.790,
|
| 722 |
+
0.959, 0.856, 0.767, 0.954, 0.847, 0.744, 0.947, 0.837, 0.721, 0.941,
|
| 723 |
+
0.828, 0.698, 0.935, 0.818, 0.675, 0.929, 0.809, 0.652, 0.923, 0.800,
|
| 724 |
+
0.629, 0.917, 0.790, 0.605, 0.912, 0.781, 0.582, 0.906, 0.771, 0.560,
|
| 725 |
+
0.900, 0.762, 0.537, 0.894, 0.753, 0.514, 0.889, 0.744, 0.491, 0.883,
|
| 726 |
+
0.735, 0.468, 0.877, 0.725, 0.445, 0.872, 0.716, 0.422, 0.866, 0.707,
|
| 727 |
+
0.399, 0.861, 0.698, 0.376, 0.856, 0.689, 0.353, 0.850, 0.680, 0.329,
|
| 728 |
+
0.845, 0.672, 0.305, 0.840, 0.663, 0.281, 0.834, 0.654, 0.256, 0.829,
|
| 729 |
+
0.645, 0.231, 0.824, 0.636, 0.204, 0.662, 0.631, 0.998, 0.672, 0.641,
|
| 730 |
+
0.993, 0.681, 0.650, 0.988, 0.691, 0.659, 0.983, 0.700, 0.669, 0.979,
|
| 731 |
+
0.710, 0.678, 0.974, 0.720, 0.687, 0.970, 0.730, 0.696, 0.966, 0.740,
|
| 732 |
+
0.706, 0.963, 0.750, 0.715, 0.960, 0.760, 0.724, 0.957, 0.771, 0.733,
|
| 733 |
+
0.954, 0.781, 0.742, 0.951, 0.791, 0.752, 0.949, 0.802, 0.761, 0.947,
|
| 734 |
+
0.812, 0.770, 0.945, 0.823, 0.779, 0.943, 0.834, 0.789, 0.942, 0.844,
|
| 735 |
+
0.798, 0.941, 0.855, 0.807, 0.940, 0.866, 0.817, 0.939, 0.877, 0.826,
|
| 736 |
+
0.938, 0.887, 0.835, 0.938, 0.898, 0.844, 0.937, 0.909, 0.853, 0.937,
|
| 737 |
+
0.919, 0.862, 0.937, 0.930, 0.870, 0.936, 0.940, 0.878, 0.936, 0.950,
|
| 738 |
+
0.885, 0.934, 0.958, 0.891, 0.932, 0.967, 0.896, 0.928, 0.974, 0.898,
|
| 739 |
+
0.922, 0.979, 0.899, 0.914, 0.982, 0.897, 0.902, 0.984, 0.893, 0.886,
|
| 740 |
+
0.984, 0.887, 0.869, 0.982, 0.880, 0.849, 0.979, 0.872, 0.828, 0.975,
|
| 741 |
+
0.864, 0.807, 0.970, 0.856, 0.785, 0.965, 0.847, 0.762, 0.959, 0.838,
|
| 742 |
+
0.739, 0.954, 0.829, 0.717, 0.948, 0.819, 0.694, 0.943, 0.810, 0.671,
|
| 743 |
+
0.937, 0.801, 0.648, 0.931, 0.792, 0.625, 0.925, 0.782, 0.602, 0.919,
|
| 744 |
+
0.773, 0.579, 0.914, 0.764, 0.556, 0.908, 0.755, 0.533, 0.902, 0.746,
|
| 745 |
+
0.511, 0.897, 0.737, 0.488, 0.891, 0.728, 0.465, 0.886, 0.719, 0.442,
|
| 746 |
+
0.880, 0.710, 0.420, 0.875, 0.701, 0.397, 0.869, 0.692, 0.374, 0.864,
|
| 747 |
+
0.683, 0.350, 0.858, 0.674, 0.327, 0.853, 0.665, 0.303, 0.848, 0.657,
|
| 748 |
+
0.279, 0.842, 0.648, 0.254, 0.837, 0.639, 0.229, 0.832, 0.630, 0.202,
|
| 749 |
+
0.671, 0.625, 0.998, 0.680, 0.635, 0.993, 0.689, 0.644, 0.988, 0.698,
|
| 750 |
+
0.654, 0.983, 0.708, 0.663, 0.978, 0.718, 0.672, 0.974, 0.727, 0.681,
|
| 751 |
+
0.970, 0.737, 0.691, 0.966, 0.747, 0.700, 0.962, 0.757, 0.709, 0.959,
|
| 752 |
+
0.767, 0.718, 0.956, 0.777, 0.727, 0.953, 0.787, 0.736, 0.950, 0.797,
|
| 753 |
+
0.745, 0.948, 0.807, 0.755, 0.946, 0.818, 0.764, 0.944, 0.828, 0.773,
|
| 754 |
+
0.942, 0.839, 0.782, 0.940, 0.849, 0.791, 0.939, 0.859, 0.800, 0.938,
|
| 755 |
+
0.870, 0.809, 0.937, 0.880, 0.818, 0.936, 0.891, 0.827, 0.935, 0.901,
|
| 756 |
+
0.835, 0.934, 0.911, 0.844, 0.933, 0.921, 0.852, 0.932, 0.931, 0.859,
|
| 757 |
+
0.931, 0.941, 0.866, 0.929, 0.950, 0.873, 0.927, 0.958, 0.878, 0.923,
|
| 758 |
+
0.966, 0.881, 0.919, 0.972, 0.883, 0.912, 0.977, 0.883, 0.903, 0.981,
|
| 759 |
+
0.882, 0.891, 0.983, 0.878, 0.876, 0.984, 0.873, 0.859, 0.983, 0.867,
|
| 760 |
+
0.841, 0.980, 0.860, 0.821, 0.977, 0.853, 0.800, 0.974, 0.845, 0.778,
|
| 761 |
+
0.969, 0.836, 0.756, 0.964, 0.828, 0.734, 0.959, 0.819, 0.712, 0.954,
|
| 762 |
+
0.810, 0.689, 0.949, 0.801, 0.666, 0.943, 0.792, 0.644, 0.938, 0.783,
|
| 763 |
+
0.621, 0.932, 0.774, 0.598, 0.927, 0.765, 0.575, 0.921, 0.756, 0.553,
|
| 764 |
+
0.916, 0.747, 0.530, 0.910, 0.738, 0.507, 0.904, 0.729, 0.485, 0.899,
|
| 765 |
+
0.721, 0.462, 0.893, 0.712, 0.439, 0.888, 0.703, 0.417, 0.882, 0.694,
|
| 766 |
+
0.394, 0.877, 0.685, 0.371, 0.871, 0.676, 0.348, 0.866, 0.668, 0.324,
|
| 767 |
+
0.861, 0.659, 0.301, 0.855, 0.650, 0.277, 0.850, 0.641, 0.252, 0.845,
|
| 768 |
+
0.633, 0.226, 0.839, 0.624, 0.200, 0.679, 0.619, 0.998, 0.688, 0.629,
|
| 769 |
+
0.993, 0.697, 0.638, 0.988, 0.706, 0.648, 0.983, 0.715, 0.657, 0.978,
|
| 770 |
+
0.725, 0.666, 0.974, 0.734, 0.675, 0.969, 0.744, 0.684, 0.965, 0.754,
|
| 771 |
+
0.693, 0.962, 0.763, 0.703, 0.958, 0.773, 0.712, 0.955, 0.783, 0.721,
|
| 772 |
+
0.952, 0.793, 0.730, 0.949, 0.803, 0.739, 0.947, 0.813, 0.748, 0.944,
|
| 773 |
+
0.823, 0.757, 0.942, 0.833, 0.766, 0.940, 0.843, 0.774, 0.938, 0.853,
|
| 774 |
+
0.783, 0.937, 0.863, 0.792, 0.935, 0.874, 0.801, 0.934, 0.884, 0.809,
|
| 775 |
+
0.932, 0.894, 0.818, 0.931, 0.904, 0.826, 0.930, 0.913, 0.833, 0.928,
|
| 776 |
+
0.923, 0.841, 0.927, 0.932, 0.848, 0.925, 0.941, 0.854, 0.922, 0.950,
|
| 777 |
+
0.859, 0.919, 0.957, 0.864, 0.915, 0.965, 0.867, 0.909, 0.971, 0.868,
|
| 778 |
+
0.901, 0.976, 0.868, 0.892, 0.980, 0.867, 0.880, 0.982, 0.863, 0.866,
|
| 779 |
+
0.983, 0.859, 0.849, 0.983, 0.854, 0.832, 0.982, 0.847, 0.812, 0.979,
|
| 780 |
+
0.840, 0.792, 0.976, 0.833, 0.771, 0.973, 0.825, 0.750, 0.969, 0.817,
|
| 781 |
+
0.728, 0.964, 0.809, 0.706, 0.959, 0.800, 0.684, 0.954, 0.792, 0.661,
|
| 782 |
+
0.949, 0.783, 0.639, 0.944, 0.774, 0.617, 0.939, 0.766, 0.594, 0.933,
|
| 783 |
+
0.757, 0.572, 0.928, 0.748, 0.549, 0.922, 0.739, 0.527, 0.917, 0.731,
|
| 784 |
+
0.504, 0.911, 0.722, 0.481, 0.906, 0.713, 0.459, 0.901, 0.704, 0.436,
|
| 785 |
+
0.895, 0.695, 0.414, 0.890, 0.687, 0.391, 0.884, 0.678, 0.368, 0.879,
|
| 786 |
+
0.669, 0.345, 0.873, 0.661, 0.322, 0.868, 0.652, 0.298, 0.863, 0.643,
|
| 787 |
+
0.274, 0.857, 0.635, 0.249, 0.852, 0.626, 0.224, 0.846, 0.617, 0.197,
|
| 788 |
+
0.686, 0.613, 0.998, 0.695, 0.622, 0.993, 0.704, 0.632, 0.987, 0.713,
|
| 789 |
+
0.641, 0.982, 0.722, 0.650, 0.977, 0.732, 0.660, 0.973, 0.741, 0.669,
|
| 790 |
+
0.969, 0.750, 0.678, 0.965, 0.760, 0.687, 0.961, 0.769, 0.696, 0.957,
|
| 791 |
+
0.779, 0.705, 0.954, 0.789, 0.714, 0.951, 0.798, 0.723, 0.948, 0.808,
|
| 792 |
+
0.731, 0.945, 0.818, 0.740, 0.943, 0.828, 0.749, 0.940, 0.838, 0.758,
|
| 793 |
+
0.938, 0.847, 0.766, 0.936, 0.857, 0.775, 0.934, 0.867, 0.783, 0.932,
|
| 794 |
+
0.877, 0.792, 0.930, 0.887, 0.800, 0.929, 0.896, 0.808, 0.927, 0.906,
|
| 795 |
+
0.815, 0.925, 0.915, 0.823, 0.923, 0.924, 0.829, 0.921, 0.933, 0.836,
|
| 796 |
+
0.918, 0.942, 0.841, 0.915, 0.950, 0.846, 0.911, 0.957, 0.850, 0.906,
|
| 797 |
+
0.964, 0.852, 0.899, 0.970, 0.853, 0.891, 0.975, 0.853, 0.881, 0.979,
|
| 798 |
+
0.852, 0.869, 0.981, 0.849, 0.855, 0.983, 0.845, 0.840, 0.983, 0.840,
|
| 799 |
+
0.822, 0.982, 0.834, 0.804, 0.981, 0.828, 0.784, 0.978, 0.821, 0.764,
|
| 800 |
+
0.975, 0.814, 0.743, 0.972, 0.806, 0.722, 0.968, 0.798, 0.700, 0.964,
|
| 801 |
+
0.790, 0.678, 0.959, 0.782, 0.656, 0.954, 0.773, 0.634, 0.949, 0.765,
|
| 802 |
+
0.612, 0.944, 0.757, 0.590, 0.939, 0.748, 0.567, 0.934, 0.739, 0.545,
|
| 803 |
+
0.929, 0.731, 0.523, 0.923, 0.722, 0.500, 0.918, 0.714, 0.478, 0.913,
|
| 804 |
+
0.705, 0.456, 0.907, 0.696, 0.433, 0.902, 0.688, 0.411, 0.896, 0.679,
|
| 805 |
+
0.388, 0.891, 0.670, 0.365, 0.886, 0.662, 0.342, 0.880, 0.653, 0.319,
|
| 806 |
+
0.875, 0.645, 0.295, 0.869, 0.636, 0.271, 0.864, 0.628, 0.247, 0.859,
|
| 807 |
+
0.619, 0.221, 0.853, 0.611, 0.195, 0.694, 0.606, 0.998, 0.703, 0.616,
|
| 808 |
+
0.992, 0.711, 0.625, 0.987, 0.720, 0.634, 0.982, 0.729, 0.644, 0.977,
|
| 809 |
+
0.738, 0.653, 0.972, 0.747, 0.662, 0.968, 0.757, 0.671, 0.964, 0.766,
|
| 810 |
+
0.680, 0.960, 0.775, 0.689, 0.956, 0.785, 0.698, 0.953, 0.794, 0.706,
|
| 811 |
+
0.949, 0.804, 0.715, 0.946, 0.813, 0.724, 0.943, 0.823, 0.732, 0.941,
|
| 812 |
+
0.832, 0.741, 0.938, 0.842, 0.749, 0.936, 0.851, 0.758, 0.933, 0.861,
|
| 813 |
+
0.766, 0.931, 0.870, 0.774, 0.929, 0.880, 0.782, 0.927, 0.889, 0.790,
|
| 814 |
+
0.924, 0.899, 0.797, 0.922, 0.908, 0.805, 0.920, 0.917, 0.811, 0.917,
|
| 815 |
+
0.925, 0.818, 0.914, 0.934, 0.823, 0.911, 0.942, 0.828, 0.907, 0.950,
|
| 816 |
+
0.832, 0.902, 0.957, 0.836, 0.896, 0.963, 0.838, 0.889, 0.969, 0.839,
|
| 817 |
+
0.881, 0.974, 0.838, 0.871, 0.978, 0.837, 0.859, 0.980, 0.834, 0.845,
|
| 818 |
+
0.982, 0.831, 0.830, 0.983, 0.826, 0.813, 0.983, 0.821, 0.795, 0.982,
|
| 819 |
+
0.815, 0.776, 0.980, 0.809, 0.757, 0.978, 0.802, 0.736, 0.975, 0.794,
|
| 820 |
+
0.715, 0.971, 0.787, 0.694, 0.967, 0.779, 0.673, 0.963, 0.771, 0.651,
|
| 821 |
+
0.959, 0.763, 0.629, 0.954, 0.755, 0.607, 0.949, 0.747, 0.585, 0.944,
|
| 822 |
+
0.739, 0.563, 0.939, 0.730, 0.541, 0.934, 0.722, 0.519, 0.929, 0.714,
|
| 823 |
+
0.496, 0.924, 0.705, 0.474, 0.919, 0.697, 0.452, 0.913, 0.688, 0.430,
|
| 824 |
+
0.908, 0.680, 0.407, 0.903, 0.671, 0.385, 0.897, 0.663, 0.362, 0.892,
|
| 825 |
+
0.654, 0.339, 0.887, 0.646, 0.316, 0.881, 0.637, 0.293, 0.876, 0.629,
|
| 826 |
+
0.269, 0.870, 0.620, 0.244, 0.865, 0.612, 0.219, 0.860, 0.604, 0.192,
|
| 827 |
+
0.701, 0.599, 0.997, 0.710, 0.609, 0.992, 0.718, 0.618, 0.986, 0.727,
|
| 828 |
+
0.627, 0.981, 0.736, 0.636, 0.976, 0.745, 0.645, 0.971, 0.754, 0.655,
|
| 829 |
+
0.967, 0.763, 0.663, 0.963, 0.772, 0.672, 0.959, 0.781, 0.681, 0.955,
|
| 830 |
+
0.790, 0.690, 0.951, 0.799, 0.699, 0.948, 0.808, 0.707, 0.944, 0.818,
|
| 831 |
+
0.716, 0.941, 0.827, 0.724, 0.938, 0.836, 0.732, 0.935, 0.846, 0.741,
|
| 832 |
+
0.933, 0.855, 0.749, 0.930, 0.864, 0.757, 0.928, 0.874, 0.765, 0.925,
|
| 833 |
+
0.883, 0.772, 0.923, 0.892, 0.780, 0.920, 0.901, 0.787, 0.917, 0.910,
|
| 834 |
+
0.793, 0.914, 0.918, 0.800, 0.911, 0.927, 0.805, 0.908, 0.935, 0.811,
|
| 835 |
+
0.904, 0.942, 0.815, 0.899, 0.950, 0.819, 0.894, 0.956, 0.821, 0.887,
|
| 836 |
+
0.963, 0.823, 0.880, 0.968, 0.824, 0.871, 0.973, 0.824, 0.860, 0.977,
|
| 837 |
+
0.822, 0.849, 0.980, 0.820, 0.835, 0.982, 0.817, 0.820, 0.983, 0.812,
|
| 838 |
+
0.804, 0.983, 0.808, 0.786, 0.983, 0.802, 0.768, 0.981, 0.796, 0.749,
|
| 839 |
+
0.979, 0.789, 0.729, 0.977, 0.783, 0.709, 0.974, 0.776, 0.688, 0.970,
|
| 840 |
+
0.768, 0.667, 0.967, 0.761, 0.645, 0.963, 0.753, 0.624, 0.958, 0.745,
|
| 841 |
+
0.602, 0.954, 0.737, 0.580, 0.949, 0.729, 0.558, 0.944, 0.721, 0.536,
|
| 842 |
+
0.939, 0.713, 0.514, 0.934, 0.704, 0.492, 0.929, 0.696, 0.470, 0.924,
|
| 843 |
+
0.688, 0.448, 0.919, 0.680, 0.426, 0.914, 0.671, 0.404, 0.908, 0.663,
|
| 844 |
+
0.381, 0.903, 0.655, 0.359, 0.898, 0.646, 0.336, 0.893, 0.638, 0.313,
|
| 845 |
+
0.887, 0.629, 0.290, 0.882, 0.621, 0.266, 0.876, 0.613, 0.241, 0.871,
|
| 846 |
+
0.604, 0.216, 0.866, 0.596, 0.189, 0.708, 0.592, 0.997, 0.716, 0.601,
|
| 847 |
+
0.991, 0.725, 0.611, 0.985, 0.733, 0.620, 0.980, 0.742, 0.629, 0.975,
|
| 848 |
+
0.751, 0.638, 0.970, 0.759, 0.647, 0.966, 0.768, 0.656, 0.961, 0.777,
|
| 849 |
+
0.665, 0.957, 0.786, 0.673, 0.953, 0.795, 0.682, 0.949, 0.804, 0.690,
|
| 850 |
+
0.946, 0.813, 0.699, 0.942, 0.822, 0.707, 0.939, 0.831, 0.715, 0.936,
|
| 851 |
+
0.840, 0.723, 0.933, 0.849, 0.731, 0.930, 0.859, 0.739, 0.927, 0.868,
|
| 852 |
+
0.747, 0.924, 0.876, 0.754, 0.921, 0.885, 0.762, 0.918, 0.894, 0.769,
|
| 853 |
+
0.915, 0.903, 0.775, 0.912, 0.911, 0.782, 0.909, 0.920, 0.787, 0.905,
|
| 854 |
+
0.928, 0.793, 0.901, 0.935, 0.798, 0.896, 0.943, 0.802, 0.891, 0.950,
|
| 855 |
+
0.805, 0.885, 0.956, 0.807, 0.878, 0.962, 0.809, 0.870, 0.967, 0.809,
|
| 856 |
+
0.861, 0.972, 0.809, 0.850, 0.976, 0.808, 0.838, 0.979, 0.805, 0.825,
|
| 857 |
+
0.981, 0.802, 0.810, 0.983, 0.799, 0.795, 0.983, 0.794, 0.778, 0.983,
|
| 858 |
+
0.789, 0.760, 0.982, 0.783, 0.741, 0.981, 0.777, 0.721, 0.979, 0.771,
|
| 859 |
+
0.701, 0.976, 0.764, 0.681, 0.973, 0.757, 0.660, 0.970, 0.750, 0.639,
|
| 860 |
+
0.966, 0.742, 0.618, 0.962, 0.735, 0.597, 0.958, 0.727, 0.575, 0.953,
|
| 861 |
+
0.719, 0.553, 0.949, 0.711, 0.532, 0.944, 0.703, 0.510, 0.939, 0.695,
|
| 862 |
+
0.488, 0.934, 0.687, 0.466, 0.929, 0.679, 0.444, 0.924, 0.671, 0.422,
|
| 863 |
+
0.919, 0.663, 0.400, 0.914, 0.654, 0.378, 0.909, 0.646, 0.355, 0.903,
|
| 864 |
+
0.638, 0.333, 0.898, 0.630, 0.310, 0.893, 0.621, 0.287, 0.887, 0.613,
|
| 865 |
+
0.263, 0.882, 0.605, 0.238, 0.877, 0.597, 0.213, 0.871, 0.589, 0.186,
|
| 866 |
+
0.715, 0.584, 0.996, 0.723, 0.593, 0.990, 0.731, 0.603, 0.984, 0.739,
|
| 867 |
+
0.612, 0.979, 0.748, 0.621, 0.974, 0.756, 0.630, 0.969, 0.765, 0.639,
|
| 868 |
+
0.964, 0.774, 0.648, 0.960, 0.782, 0.656, 0.955, 0.791, 0.665, 0.951,
|
| 869 |
+
0.800, 0.673, 0.947, 0.809, 0.682, 0.943, 0.818, 0.690, 0.940, 0.826,
|
| 870 |
+
0.698, 0.936, 0.835, 0.706, 0.933, 0.844, 0.714, 0.930, 0.853, 0.722,
|
| 871 |
+
0.926, 0.862, 0.729, 0.923, 0.871, 0.737, 0.920, 0.879, 0.744, 0.917,
|
| 872 |
+
0.888, 0.751, 0.913, 0.896, 0.758, 0.910, 0.905, 0.764, 0.906, 0.913,
|
| 873 |
+
0.770, 0.903, 0.921, 0.775, 0.898, 0.929, 0.780, 0.894, 0.936, 0.784,
|
| 874 |
+
0.889, 0.943, 0.788, 0.883, 0.950, 0.791, 0.877, 0.956, 0.793, 0.869,
|
| 875 |
+
0.962, 0.794, 0.861, 0.967, 0.795, 0.851, 0.971, 0.794, 0.841, 0.975,
|
| 876 |
+
0.793, 0.829, 0.978, 0.791, 0.815, 0.981, 0.788, 0.801, 0.982, 0.785,
|
| 877 |
+
0.785, 0.983, 0.780, 0.769, 0.983, 0.776, 0.751, 0.983, 0.770, 0.733,
|
| 878 |
+
0.982, 0.764, 0.714, 0.980, 0.758, 0.694, 0.978, 0.752, 0.674, 0.975,
|
| 879 |
+
0.745, 0.654, 0.972, 0.738, 0.633, 0.969, 0.731, 0.612, 0.965, 0.724,
|
| 880 |
+
0.591, 0.961, 0.716, 0.570, 0.957, 0.709, 0.548, 0.953, 0.701, 0.527,
|
| 881 |
+
0.948, 0.693, 0.505, 0.943, 0.685, 0.484, 0.939, 0.678, 0.462, 0.934,
|
| 882 |
+
0.670, 0.440, 0.929, 0.662, 0.418, 0.924, 0.654, 0.396, 0.919, 0.646,
|
| 883 |
+
0.374, 0.914, 0.637, 0.352, 0.908, 0.629, 0.329, 0.903, 0.621, 0.307,
|
| 884 |
+
0.898, 0.613, 0.283, 0.893, 0.605, 0.260, 0.887, 0.597, 0.235, 0.882,
|
| 885 |
+
0.589, 0.210, 0.876, 0.581, 0.183, 0.721, 0.576, 0.995, 0.729, 0.585,
|
| 886 |
+
0.989, 0.737, 0.595, 0.983, 0.745, 0.604, 0.978, 0.754, 0.613, 0.973,
|
| 887 |
+
0.762, 0.622, 0.968, 0.770, 0.631, 0.963, 0.779, 0.639, 0.958, 0.787,
|
| 888 |
+
0.648, 0.954, 0.796, 0.656, 0.949, 0.805, 0.665, 0.945, 0.813, 0.673,
|
| 889 |
+
0.941, 0.822, 0.681, 0.937, 0.830, 0.689, 0.933, 0.839, 0.697, 0.930,
|
| 890 |
+
0.848, 0.704, 0.926, 0.856, 0.712, 0.923, 0.865, 0.719, 0.919, 0.873,
|
| 891 |
+
0.726, 0.916, 0.882, 0.733, 0.912, 0.890, 0.740, 0.908, 0.898, 0.746,
|
| 892 |
+
0.905, 0.906, 0.752, 0.901, 0.914, 0.757, 0.896, 0.922, 0.762, 0.892,
|
| 893 |
+
0.929, 0.767, 0.887, 0.937, 0.771, 0.881, 0.943, 0.774, 0.875, 0.950,
|
| 894 |
+
0.777, 0.868, 0.956, 0.779, 0.860, 0.961, 0.780, 0.851, 0.966, 0.780,
|
| 895 |
+
0.842, 0.971, 0.780, 0.831, 0.975, 0.779, 0.819, 0.978, 0.777, 0.806,
|
| 896 |
+
0.980, 0.774, 0.791, 0.982, 0.771, 0.776, 0.983, 0.767, 0.760, 0.984,
|
| 897 |
+
0.762, 0.742, 0.983, 0.757, 0.725, 0.983, 0.752, 0.706, 0.981, 0.746,
|
| 898 |
+
0.687, 0.979, 0.740, 0.667, 0.977, 0.733, 0.647, 0.974, 0.727, 0.627,
|
| 899 |
+
0.971, 0.720, 0.606, 0.968, 0.713, 0.585, 0.964, 0.706, 0.564, 0.960,
|
| 900 |
+
0.698, 0.543, 0.956, 0.691, 0.522, 0.952, 0.683, 0.501, 0.947, 0.676,
|
| 901 |
+
0.479, 0.943, 0.668, 0.458, 0.938, 0.660, 0.436, 0.933, 0.652, 0.414,
|
| 902 |
+
0.928, 0.644, 0.392, 0.923, 0.636, 0.370, 0.918, 0.629, 0.348, 0.913,
|
| 903 |
+
0.621, 0.326, 0.908, 0.613, 0.303, 0.903, 0.605, 0.280, 0.897, 0.597,
|
| 904 |
+
0.257, 0.892, 0.589, 0.232, 0.887, 0.581, 0.207, 0.881, 0.573, 0.180,
|
| 905 |
+
0.727, 0.568, 0.994, 0.735, 0.577, 0.988, 0.743, 0.586, 0.982, 0.751,
|
| 906 |
+
0.595, 0.977, 0.759, 0.604, 0.971, 0.767, 0.613, 0.966, 0.776, 0.622,
|
| 907 |
+
0.961, 0.784, 0.630, 0.956, 0.792, 0.639, 0.951, 0.801, 0.647, 0.947,
|
| 908 |
+
0.809, 0.655, 0.943, 0.817, 0.663, 0.938, 0.826, 0.671, 0.934, 0.834,
|
| 909 |
+
0.679, 0.930, 0.843, 0.687, 0.927, 0.851, 0.694, 0.923, 0.859, 0.702,
|
| 910 |
+
0.919, 0.868, 0.709, 0.915, 0.876, 0.715, 0.911, 0.884, 0.722, 0.907,
|
| 911 |
+
0.892, 0.728, 0.903, 0.900, 0.734, 0.899, 0.908, 0.740, 0.895, 0.916,
|
| 912 |
+
0.745, 0.890, 0.923, 0.750, 0.885, 0.930, 0.754, 0.879, 0.937, 0.758,
|
| 913 |
+
0.873, 0.944, 0.761, 0.867, 0.950, 0.763, 0.859, 0.956, 0.765, 0.851,
|
| 914 |
+
0.961, 0.766, 0.842, 0.966, 0.766, 0.832, 0.970, 0.766, 0.821, 0.974,
|
| 915 |
+
0.764, 0.809, 0.977, 0.762, 0.796, 0.980, 0.760, 0.782, 0.982, 0.757,
|
| 916 |
+
0.767, 0.983, 0.753, 0.751, 0.984, 0.749, 0.734, 0.984, 0.744, 0.716,
|
| 917 |
+
0.983, 0.739, 0.698, 0.982, 0.733, 0.679, 0.980, 0.727, 0.660, 0.978,
|
| 918 |
+
0.721, 0.640, 0.976, 0.715, 0.620, 0.973, 0.708, 0.600, 0.970, 0.701,
|
| 919 |
+
0.579, 0.967, 0.694, 0.559, 0.963, 0.687, 0.538, 0.959, 0.680, 0.517,
|
| 920 |
+
0.955, 0.673, 0.496, 0.951, 0.665, 0.474, 0.946, 0.658, 0.453, 0.942,
|
| 921 |
+
0.650, 0.432, 0.937, 0.643, 0.410, 0.932, 0.635, 0.388, 0.927, 0.627,
|
| 922 |
+
0.367, 0.922, 0.619, 0.345, 0.917, 0.612, 0.322, 0.912, 0.604, 0.300,
|
| 923 |
+
0.907, 0.596, 0.277, 0.902, 0.588, 0.253, 0.897, 0.580, 0.229, 0.891,
|
| 924 |
+
0.572, 0.204, 0.886, 0.564, 0.177, 0.733, 0.559, 0.993, 0.741, 0.568,
|
| 925 |
+
0.987, 0.749, 0.577, 0.981, 0.757, 0.587, 0.975, 0.765, 0.595, 0.970,
|
| 926 |
+
0.773, 0.604, 0.964, 0.781, 0.613, 0.959, 0.789, 0.621, 0.954, 0.797,
|
| 927 |
+
0.630, 0.949, 0.805, 0.638, 0.945, 0.813, 0.646, 0.940, 0.821, 0.654,
|
| 928 |
+
0.936, 0.830, 0.662, 0.931, 0.838, 0.669, 0.927, 0.846, 0.677, 0.923,
|
| 929 |
+
0.854, 0.684, 0.919, 0.862, 0.691, 0.915, 0.870, 0.698, 0.911, 0.879,
|
| 930 |
+
0.704, 0.907, 0.886, 0.711, 0.902, 0.894, 0.717, 0.898, 0.902, 0.722,
|
| 931 |
+
0.893, 0.910, 0.727, 0.889, 0.917, 0.732, 0.883, 0.924, 0.737, 0.878,
|
| 932 |
+
0.931, 0.741, 0.872, 0.938, 0.744, 0.866, 0.944, 0.747, 0.859, 0.950,
|
| 933 |
+
0.749, 0.851, 0.956, 0.751, 0.842, 0.961, 0.751, 0.833, 0.966, 0.752,
|
| 934 |
+
0.823, 0.970, 0.751, 0.812, 0.974, 0.750, 0.800, 0.977, 0.748, 0.787,
|
| 935 |
+
0.979, 0.746, 0.773, 0.981, 0.743, 0.758, 0.983, 0.739, 0.742, 0.984,
|
| 936 |
+
0.735, 0.725, 0.984, 0.731, 0.708, 0.983, 0.726, 0.690, 0.983, 0.721,
|
| 937 |
+
0.672, 0.981, 0.715, 0.653, 0.980, 0.709, 0.633, 0.977, 0.703, 0.614,
|
| 938 |
+
0.975, 0.697, 0.594, 0.972, 0.690, 0.573, 0.969, 0.683, 0.553, 0.965,
|
| 939 |
+
0.676, 0.532, 0.962, 0.669, 0.512, 0.958, 0.662, 0.491, 0.954, 0.655,
|
| 940 |
+
0.470, 0.949, 0.648, 0.448, 0.945, 0.640, 0.427, 0.941, 0.633, 0.406,
|
| 941 |
+
0.936, 0.625, 0.384, 0.931, 0.618, 0.363, 0.926, 0.610, 0.341, 0.921,
|
| 942 |
+
0.602, 0.319, 0.916, 0.595, 0.296, 0.911, 0.587, 0.273, 0.906, 0.579,
|
| 943 |
+
0.250, 0.901, 0.571, 0.226, 0.896, 0.563, 0.201, 0.890, 0.556, 0.174,
|
| 944 |
+
0.739, 0.550, 0.992, 0.747, 0.559, 0.986, 0.754, 0.568, 0.980, 0.762,
|
| 945 |
+
0.577, 0.974, 0.770, 0.586, 0.968, 0.778, 0.595, 0.962, 0.785, 0.603,
|
| 946 |
+
0.957, 0.793, 0.612, 0.952, 0.801, 0.620, 0.947, 0.809, 0.628, 0.942,
|
| 947 |
+
0.817, 0.636, 0.937, 0.825, 0.644, 0.933, 0.833, 0.651, 0.928, 0.841,
|
| 948 |
+
0.659, 0.924, 0.849, 0.666, 0.919, 0.857, 0.673, 0.915, 0.865, 0.680,
|
| 949 |
+
0.911, 0.873, 0.686, 0.906, 0.881, 0.693, 0.902, 0.889, 0.699, 0.897,
|
| 950 |
+
0.896, 0.705, 0.892, 0.904, 0.710, 0.887, 0.911, 0.715, 0.882, 0.918,
|
| 951 |
+
0.720, 0.877, 0.925, 0.724, 0.871, 0.932, 0.727, 0.865, 0.938, 0.730,
|
| 952 |
+
0.858, 0.944, 0.733, 0.850, 0.950, 0.735, 0.842, 0.956, 0.736, 0.834,
|
| 953 |
+
0.961, 0.737, 0.824, 0.965, 0.737, 0.814, 0.970, 0.737, 0.802, 0.973,
|
| 954 |
+
0.736, 0.790, 0.976, 0.734, 0.777, 0.979, 0.732, 0.763, 0.981, 0.729,
|
| 955 |
+
0.749, 0.982, 0.726, 0.733, 0.983, 0.722, 0.717, 0.984, 0.717, 0.700,
|
| 956 |
+
0.984, 0.713, 0.682, 0.983, 0.708, 0.664, 0.982, 0.702, 0.645, 0.980,
|
| 957 |
+
0.697, 0.626, 0.979, 0.691, 0.607, 0.976, 0.685, 0.587, 0.974, 0.678,
|
| 958 |
+
0.567, 0.971, 0.672, 0.547, 0.967, 0.665, 0.527, 0.964, 0.658, 0.506,
|
| 959 |
+
0.960, 0.651, 0.485, 0.956, 0.644, 0.465, 0.952, 0.637, 0.444, 0.948,
|
| 960 |
+
0.630, 0.423, 0.944, 0.623, 0.401, 0.939, 0.615, 0.380, 0.934, 0.608,
|
| 961 |
+
0.358, 0.930, 0.600, 0.337, 0.925, 0.593, 0.315, 0.920, 0.585, 0.292,
|
| 962 |
+
0.915, 0.578, 0.270, 0.910, 0.570, 0.246, 0.905, 0.562, 0.222, 0.899,
|
| 963 |
+
0.555, 0.197, 0.894, 0.547, 0.171, 0.745, 0.540, 0.991, 0.752, 0.550,
|
| 964 |
+
0.984, 0.760, 0.559, 0.978, 0.767, 0.568, 0.972, 0.775, 0.577, 0.966,
|
| 965 |
+
0.782, 0.585, 0.960, 0.790, 0.594, 0.955, 0.798, 0.602, 0.950, 0.806,
|
| 966 |
+
0.610, 0.944, 0.813, 0.618, 0.939, 0.821, 0.626, 0.934, 0.829, 0.634,
|
| 967 |
+
0.930, 0.837, 0.641, 0.925, 0.845, 0.648, 0.920, 0.852, 0.655, 0.915,
|
| 968 |
+
0.860, 0.662, 0.911, 0.868, 0.669, 0.906, 0.876, 0.675, 0.901, 0.883,
|
| 969 |
+
0.681, 0.897, 0.891, 0.687, 0.892, 0.898, 0.692, 0.887, 0.905, 0.697,
|
| 970 |
+
0.881, 0.912, 0.702, 0.876, 0.919, 0.707, 0.870, 0.926, 0.710, 0.864,
|
| 971 |
+
0.932, 0.714, 0.857, 0.939, 0.717, 0.850, 0.945, 0.719, 0.842, 0.950,
|
| 972 |
+
0.721, 0.834, 0.956, 0.722, 0.825, 0.961, 0.723, 0.815, 0.965, 0.723,
|
| 973 |
+
0.804, 0.969, 0.723, 0.793, 0.973, 0.722, 0.781, 0.976, 0.720, 0.768,
|
| 974 |
+
0.978, 0.718, 0.754, 0.981, 0.715, 0.739, 0.982, 0.712, 0.724, 0.983,
|
| 975 |
+
0.708, 0.708, 0.984, 0.704, 0.691, 0.984, 0.700, 0.674, 0.983, 0.695,
|
| 976 |
+
0.656, 0.982, 0.690, 0.638, 0.981, 0.684, 0.619, 0.979, 0.679, 0.600,
|
| 977 |
+
0.977, 0.673, 0.581, 0.975, 0.666, 0.561, 0.972, 0.660, 0.541, 0.969,
|
| 978 |
+
0.654, 0.521, 0.966, 0.647, 0.501, 0.962, 0.640, 0.480, 0.959, 0.634,
|
| 979 |
+
0.459, 0.955, 0.627, 0.439, 0.951, 0.620, 0.418, 0.946, 0.612, 0.397,
|
| 980 |
+
0.942, 0.605, 0.376, 0.937, 0.598, 0.354, 0.933, 0.591, 0.333, 0.928,
|
| 981 |
+
0.583, 0.311, 0.923, 0.576, 0.289, 0.918, 0.568, 0.266, 0.913, 0.561,
|
| 982 |
+
0.243, 0.908, 0.553, 0.219, 0.903, 0.546, 0.194, 0.898, 0.538, 0.167,
|
| 983 |
+
0.750, 0.531, 0.989, 0.757, 0.540, 0.983, 0.765, 0.549, 0.976, 0.772,
|
| 984 |
+
0.558, 0.970, 0.779, 0.567, 0.964, 0.787, 0.575, 0.958, 0.794, 0.584,
|
| 985 |
+
0.953, 0.802, 0.592, 0.947, 0.810, 0.600, 0.942, 0.817, 0.608, 0.936,
|
| 986 |
+
0.825, 0.615, 0.931, 0.833, 0.623, 0.926, 0.840, 0.630, 0.921, 0.848,
|
| 987 |
+
0.637, 0.916, 0.855, 0.644, 0.911, 0.863, 0.651, 0.907, 0.870, 0.657,
|
| 988 |
+
0.902, 0.878, 0.663, 0.897, 0.885, 0.669, 0.891, 0.893, 0.675, 0.886,
|
| 989 |
+
0.900, 0.680, 0.881, 0.907, 0.685, 0.875, 0.914, 0.689, 0.869, 0.920,
|
| 990 |
+
0.693, 0.863, 0.927, 0.697, 0.857, 0.933, 0.700, 0.850, 0.939, 0.703,
|
| 991 |
+
0.842, 0.945, 0.705, 0.834, 0.950, 0.707, 0.825, 0.956, 0.708, 0.816,
|
| 992 |
+
0.960, 0.709, 0.806, 0.965, 0.709, 0.795, 0.969, 0.708, 0.784, 0.972,
|
| 993 |
+
0.707, 0.772, 0.975, 0.706, 0.759, 0.978, 0.704, 0.745, 0.980, 0.701,
|
| 994 |
+
0.731, 0.982, 0.698, 0.715, 0.983, 0.694, 0.699, 0.984, 0.691, 0.683,
|
| 995 |
+
0.984, 0.686, 0.666, 0.983, 0.682, 0.648, 0.983, 0.677, 0.630, 0.982,
|
| 996 |
+
0.672, 0.612, 0.980, 0.666, 0.593, 0.978, 0.660, 0.574, 0.976, 0.655,
|
| 997 |
+
0.554, 0.973, 0.648, 0.535, 0.971, 0.642, 0.515, 0.967, 0.636, 0.495,
|
| 998 |
+
0.964, 0.629, 0.475, 0.961, 0.623, 0.454, 0.957, 0.616, 0.434, 0.953,
|
| 999 |
+
0.609, 0.413, 0.949, 0.602, 0.392, 0.944, 0.595, 0.371, 0.940, 0.588,
|
| 1000 |
+
0.350, 0.936, 0.580, 0.328, 0.931, 0.573, 0.307, 0.926, 0.566, 0.285,
|
| 1001 |
+
0.921, 0.559, 0.262, 0.916, 0.551, 0.239, 0.911, 0.544, 0.215, 0.906,
|
| 1002 |
+
0.536, 0.190, 0.901, 0.529, 0.164, 0.755, 0.521, 0.988, 0.762, 0.530,
|
| 1003 |
+
0.981, 0.770, 0.539, 0.975, 0.777, 0.548, 0.968, 0.784, 0.557, 0.962,
|
| 1004 |
+
0.791, 0.565, 0.956, 0.799, 0.573, 0.950, 0.806, 0.582, 0.944, 0.814,
|
| 1005 |
+
0.589, 0.939, 0.821, 0.597, 0.933, 0.828, 0.605, 0.928, 0.836, 0.612,
|
| 1006 |
+
0.923, 0.843, 0.619, 0.918, 0.851, 0.626, 0.912, 0.858, 0.633, 0.907,
|
| 1007 |
+
0.866, 0.639, 0.902, 0.873, 0.645, 0.897, 0.880, 0.651, 0.892, 0.887,
|
| 1008 |
+
0.657, 0.886, 0.894, 0.662, 0.881, 0.901, 0.667, 0.875, 0.908, 0.672,
|
| 1009 |
+
0.869, 0.915, 0.676, 0.863, 0.921, 0.680, 0.856, 0.928, 0.684, 0.849,
|
| 1010 |
+
0.934, 0.687, 0.842, 0.940, 0.689, 0.834, 0.945, 0.691, 0.826, 0.951,
|
| 1011 |
+
0.693, 0.817, 0.956, 0.694, 0.807, 0.960, 0.695, 0.797, 0.964, 0.695,
|
| 1012 |
+
0.787, 0.968, 0.694, 0.775, 0.972, 0.693, 0.763, 0.975, 0.692, 0.750,
|
| 1013 |
+
0.977, 0.690, 0.736, 0.980, 0.687, 0.722, 0.981, 0.684, 0.707, 0.982,
|
| 1014 |
+
0.681, 0.691, 0.983, 0.677, 0.675, 0.984, 0.673, 0.658, 0.983, 0.669,
|
| 1015 |
+
0.641, 0.983, 0.664, 0.623, 0.982, 0.659, 0.605, 0.980, 0.654, 0.586,
|
| 1016 |
+
0.979, 0.648, 0.567, 0.977, 0.642, 0.548, 0.974, 0.637, 0.529, 0.972,
|
| 1017 |
+
0.630, 0.509, 0.969, 0.624, 0.489, 0.966, 0.618, 0.469, 0.962, 0.611,
|
| 1018 |
+
0.449, 0.959, 0.605, 0.429, 0.955, 0.598, 0.408, 0.951, 0.591, 0.387,
|
| 1019 |
+
0.947, 0.584, 0.367, 0.942, 0.577, 0.346, 0.938, 0.570, 0.324, 0.933,
|
| 1020 |
+
0.563, 0.303, 0.929, 0.556, 0.281, 0.924, 0.549, 0.258, 0.919, 0.541,
|
| 1021 |
+
0.235, 0.914, 0.534, 0.212, 0.909, 0.527, 0.187, 0.904, 0.519, 0.160,
|
| 1022 |
+
0.760, 0.510, 0.986, 0.767, 0.520, 0.979, 0.774, 0.529, 0.973, 0.781,
|
| 1023 |
+
0.538, 0.966, 0.788, 0.546, 0.960, 0.796, 0.555, 0.954, 0.803, 0.563,
|
| 1024 |
+
0.948, 0.810, 0.571, 0.942, 0.817, 0.579, 0.936, 0.825, 0.586, 0.930,
|
| 1025 |
+
0.832, 0.594, 0.925, 0.839, 0.601, 0.919, 0.846, 0.608, 0.914, 0.854,
|
| 1026 |
+
0.615, 0.908, 0.861, 0.621, 0.903, 0.868, 0.627, 0.897, 0.875, 0.633,
|
| 1027 |
+
0.892, 0.882, 0.639, 0.886, 0.889, 0.645, 0.881, 0.896, 0.650, 0.875,
|
| 1028 |
+
0.903, 0.655, 0.869, 0.909, 0.659, 0.863, 0.916, 0.663, 0.856, 0.922,
|
| 1029 |
+
0.667, 0.849, 0.928, 0.670, 0.842, 0.934, 0.673, 0.834, 0.940, 0.675,
|
| 1030 |
+
0.826, 0.945, 0.677, 0.818, 0.951, 0.679, 0.809, 0.955, 0.680, 0.799,
|
| 1031 |
+
0.960, 0.680, 0.789, 0.964, 0.680, 0.778, 0.968, 0.680, 0.766, 0.971,
|
| 1032 |
+
0.679, 0.754, 0.974, 0.677, 0.741, 0.977, 0.676, 0.727, 0.979, 0.673,
|
| 1033 |
+
0.713, 0.981, 0.670, 0.698, 0.982, 0.667, 0.682, 0.983, 0.664, 0.666,
|
| 1034 |
+
0.983, 0.660, 0.650, 0.983, 0.655, 0.633, 0.983, 0.651, 0.615, 0.982,
|
| 1035 |
+
0.646, 0.597, 0.981, 0.641, 0.579, 0.979, 0.636, 0.560, 0.977, 0.630,
|
| 1036 |
+
0.541, 0.975, 0.625, 0.522, 0.973, 0.619, 0.503, 0.970, 0.613, 0.483,
|
| 1037 |
+
0.967, 0.606, 0.463, 0.964, 0.600, 0.443, 0.960, 0.594, 0.423, 0.956,
|
| 1038 |
+
0.587, 0.403, 0.953, 0.580, 0.383, 0.949, 0.574, 0.362, 0.944, 0.567,
|
| 1039 |
+
0.341, 0.940, 0.560, 0.320, 0.936, 0.553, 0.298, 0.931, 0.546, 0.277,
|
| 1040 |
+
0.926, 0.539, 0.254, 0.922, 0.532, 0.232, 0.917, 0.524, 0.208, 0.912,
|
| 1041 |
+
0.517, 0.183, 0.906, 0.510, 0.156, 0.765, 0.499, 0.985, 0.772, 0.509,
|
| 1042 |
+
0.978, 0.779, 0.518, 0.971, 0.786, 0.527, 0.964, 0.793, 0.535, 0.957,
|
| 1043 |
+
0.800, 0.544, 0.951, 0.807, 0.552, 0.945, 0.814, 0.560, 0.939, 0.821,
|
| 1044 |
+
0.568, 0.933, 0.828, 0.575, 0.927, 0.835, 0.582, 0.921, 0.842, 0.589,
|
| 1045 |
+
0.915, 0.849, 0.596, 0.910, 0.856, 0.603, 0.904, 0.863, 0.609, 0.898,
|
| 1046 |
+
0.870, 0.615, 0.893, 0.877, 0.621, 0.887, 0.884, 0.627, 0.881, 0.891,
|
| 1047 |
+
0.632, 0.875, 0.898, 0.637, 0.869, 0.904, 0.642, 0.863, 0.911, 0.646,
|
| 1048 |
+
0.856, 0.917, 0.650, 0.849, 0.923, 0.653, 0.842, 0.929, 0.657, 0.835,
|
| 1049 |
+
0.935, 0.659, 0.827, 0.940, 0.662, 0.818, 0.946, 0.663, 0.810, 0.951,
|
| 1050 |
+
0.665, 0.800, 0.955, 0.666, 0.790, 0.960, 0.666, 0.780, 0.964, 0.666,
|
| 1051 |
+
0.769, 0.967, 0.666, 0.757, 0.971, 0.665, 0.745, 0.974, 0.663, 0.732,
|
| 1052 |
+
0.976, 0.662, 0.718, 0.978, 0.659, 0.704, 0.980, 0.657, 0.689, 0.981,
|
| 1053 |
+
0.654, 0.674, 0.982, 0.650, 0.658, 0.983, 0.646, 0.642, 0.983, 0.642,
|
| 1054 |
+
0.625, 0.983, 0.638, 0.608, 0.982, 0.633, 0.590, 0.981, 0.628, 0.572,
|
| 1055 |
+
0.979, 0.623, 0.553, 0.978, 0.618, 0.535, 0.976, 0.612, 0.516, 0.973,
|
| 1056 |
+
0.607, 0.497, 0.971, 0.601, 0.477, 0.968, 0.595, 0.458, 0.965, 0.589,
|
| 1057 |
+
0.438, 0.961, 0.582, 0.418, 0.958, 0.576, 0.398, 0.954, 0.569, 0.378,
|
| 1058 |
+
0.950, 0.563, 0.357, 0.946, 0.556, 0.336, 0.942, 0.549, 0.315, 0.938,
|
| 1059 |
+
0.542, 0.294, 0.933, 0.536, 0.273, 0.928, 0.529, 0.250, 0.924, 0.522,
|
| 1060 |
+
0.228, 0.919, 0.514, 0.204, 0.914, 0.507, 0.179, 0.909, 0.500, 0.153,
|
| 1061 |
+
0.770, 0.488, 0.983, 0.777, 0.498, 0.976, 0.783, 0.507, 0.969, 0.790,
|
| 1062 |
+
0.516, 0.962, 0.797, 0.524, 0.955, 0.804, 0.533, 0.948, 0.811, 0.541,
|
| 1063 |
+
0.942, 0.817, 0.549, 0.936, 0.824, 0.556, 0.930, 0.831, 0.564, 0.924,
|
| 1064 |
+
0.838, 0.571, 0.918, 0.845, 0.578, 0.912, 0.852, 0.584, 0.906, 0.859,
|
| 1065 |
+
0.591, 0.900, 0.866, 0.597, 0.894, 0.873, 0.603, 0.888, 0.879, 0.609,
|
| 1066 |
+
0.882, 0.886, 0.614, 0.876, 0.893, 0.619, 0.869, 0.899, 0.624, 0.863,
|
| 1067 |
+
0.906, 0.629, 0.856, 0.912, 0.633, 0.850, 0.918, 0.637, 0.843, 0.924,
|
| 1068 |
+
0.640, 0.835, 0.930, 0.643, 0.827, 0.935, 0.646, 0.819, 0.941, 0.648,
|
| 1069 |
+
0.811, 0.946, 0.649, 0.802, 0.951, 0.651, 0.792, 0.955, 0.652, 0.782,
|
| 1070 |
+
0.959, 0.652, 0.771, 0.963, 0.652, 0.760, 0.967, 0.652, 0.749, 0.970,
|
| 1071 |
+
0.651, 0.736, 0.973, 0.649, 0.723, 0.976, 0.647, 0.710, 0.978, 0.645,
|
| 1072 |
+
0.696, 0.980, 0.643, 0.681, 0.981, 0.640, 0.666, 0.982, 0.637, 0.650,
|
| 1073 |
+
0.982, 0.633, 0.634, 0.983, 0.629, 0.617, 0.982, 0.625, 0.600, 0.982,
|
| 1074 |
+
0.620, 0.582, 0.981, 0.616, 0.565, 0.979, 0.611, 0.546, 0.978, 0.605,
|
| 1075 |
+
0.528, 0.976, 0.600, 0.509, 0.974, 0.595, 0.490, 0.971, 0.589, 0.471,
|
| 1076 |
+
0.969, 0.583, 0.452, 0.966, 0.577, 0.432, 0.962, 0.571, 0.413, 0.959,
|
| 1077 |
+
0.565, 0.393, 0.955, 0.558, 0.373, 0.952, 0.552, 0.352, 0.948, 0.545,
|
| 1078 |
+
0.332, 0.943, 0.539, 0.311, 0.939, 0.532, 0.290, 0.935, 0.525, 0.268,
|
| 1079 |
+
0.930, 0.518, 0.246, 0.926, 0.511, 0.224, 0.921, 0.504, 0.200, 0.916,
|
| 1080 |
+
0.497, 0.175, 0.911, 0.490, 0.149, 0.775, 0.477, 0.981, 0.781, 0.486,
|
| 1081 |
+
0.974, 0.788, 0.495, 0.966, 0.794, 0.504, 0.959, 0.801, 0.513, 0.952,
|
| 1082 |
+
0.808, 0.521, 0.946, 0.814, 0.529, 0.939, 0.821, 0.537, 0.933, 0.828,
|
| 1083 |
+
0.545, 0.926, 0.835, 0.552, 0.920, 0.841, 0.559, 0.914, 0.848, 0.566,
|
| 1084 |
+
0.908, 0.855, 0.572, 0.901, 0.862, 0.579, 0.895, 0.868, 0.585, 0.889,
|
| 1085 |
+
0.875, 0.591, 0.883, 0.881, 0.596, 0.877, 0.888, 0.601, 0.870, 0.894,
|
| 1086 |
+
0.606, 0.864, 0.901, 0.611, 0.857, 0.907, 0.615, 0.850, 0.913, 0.619,
|
| 1087 |
+
0.843, 0.919, 0.623, 0.836, 0.925, 0.626, 0.828, 0.930, 0.629, 0.820,
|
| 1088 |
+
0.936, 0.632, 0.812, 0.941, 0.634, 0.803, 0.946, 0.635, 0.794, 0.951,
|
| 1089 |
+
0.637, 0.784, 0.955, 0.637, 0.774, 0.959, 0.638, 0.763, 0.963, 0.638,
|
| 1090 |
+
0.752, 0.967, 0.637, 0.740, 0.970, 0.636, 0.728, 0.973, 0.635, 0.715,
|
| 1091 |
+
0.975, 0.633, 0.701, 0.977, 0.631, 0.687, 0.979, 0.629, 0.672, 0.980,
|
| 1092 |
+
0.626, 0.657, 0.981, 0.623, 0.642, 0.982, 0.619, 0.626, 0.982, 0.616,
|
| 1093 |
+
0.609, 0.982, 0.612, 0.592, 0.981, 0.607, 0.575, 0.981, 0.603, 0.557,
|
| 1094 |
+
0.979, 0.598, 0.540, 0.978, 0.593, 0.521, 0.976, 0.588, 0.503, 0.974,
|
| 1095 |
+
0.582, 0.484, 0.972, 0.577, 0.465, 0.969, 0.571, 0.446, 0.966, 0.565,
|
| 1096 |
+
0.427, 0.963, 0.559, 0.407, 0.960, 0.553, 0.387, 0.956, 0.547, 0.368,
|
| 1097 |
+
0.953, 0.541, 0.347, 0.949, 0.534, 0.327, 0.945, 0.528, 0.306, 0.941,
|
| 1098 |
+
0.521, 0.285, 0.936, 0.514, 0.264, 0.932, 0.508, 0.242, 0.927, 0.501,
|
| 1099 |
+
0.220, 0.922, 0.494, 0.196, 0.918, 0.487, 0.172, 0.913, 0.480, 0.145,
|
| 1100 |
+
0.779, 0.465, 0.979, 0.785, 0.474, 0.971, 0.792, 0.484, 0.964, 0.798,
|
| 1101 |
+
0.492, 0.957, 0.805, 0.501, 0.950, 0.811, 0.509, 0.943, 0.818, 0.517,
|
| 1102 |
+
0.936, 0.824, 0.525, 0.929, 0.831, 0.533, 0.923, 0.838, 0.540, 0.916,
|
| 1103 |
+
0.844, 0.547, 0.910, 0.851, 0.554, 0.904, 0.857, 0.560, 0.897, 0.864,
|
| 1104 |
+
0.566, 0.891, 0.870, 0.572, 0.884, 0.877, 0.578, 0.878, 0.883, 0.583,
|
| 1105 |
+
0.871, 0.890, 0.589, 0.865, 0.896, 0.593, 0.858, 0.902, 0.598, 0.851,
|
| 1106 |
+
0.908, 0.602, 0.844, 0.914, 0.606, 0.837, 0.920, 0.609, 0.829, 0.925,
|
| 1107 |
+
0.613, 0.821, 0.931, 0.615, 0.813, 0.936, 0.618, 0.804, 0.941, 0.620,
|
| 1108 |
+
0.795, 0.946, 0.621, 0.786, 0.950, 0.622, 0.776, 0.955, 0.623, 0.765,
|
| 1109 |
+
0.959, 0.624, 0.755, 0.963, 0.624, 0.743, 0.966, 0.623, 0.731, 0.969,
|
| 1110 |
+
0.622, 0.719, 0.972, 0.621, 0.706, 0.974, 0.619, 0.693, 0.976, 0.617,
|
| 1111 |
+
0.679, 0.978, 0.615, 0.664, 0.979, 0.612, 0.649, 0.980, 0.609, 0.634,
|
| 1112 |
+
0.981, 0.606, 0.618, 0.981, 0.602, 0.601, 0.981, 0.598, 0.585, 0.981,
|
| 1113 |
+
0.594, 0.568, 0.980, 0.590, 0.550, 0.979, 0.585, 0.533, 0.978, 0.580,
|
| 1114 |
+
0.515, 0.976, 0.575, 0.496, 0.974, 0.570, 0.478, 0.972, 0.565, 0.459,
|
| 1115 |
+
0.969, 0.559, 0.440, 0.967, 0.553, 0.421, 0.964, 0.547, 0.402, 0.960,
|
| 1116 |
+
0.542, 0.382, 0.957, 0.535, 0.362, 0.953, 0.529, 0.342, 0.950, 0.523,
|
| 1117 |
+
0.322, 0.946, 0.517, 0.302, 0.942, 0.510, 0.281, 0.937, 0.504, 0.260,
|
| 1118 |
+
0.933, 0.497, 0.238, 0.929, 0.490, 0.216, 0.924, 0.484, 0.192, 0.919,
|
| 1119 |
+
0.477, 0.168, 0.914, 0.470, 0.141, 0.783, 0.453, 0.977, 0.789, 0.462,
|
| 1120 |
+
0.969, 0.796, 0.471, 0.962, 0.802, 0.480, 0.954, 0.808, 0.489, 0.947,
|
| 1121 |
+
0.815, 0.497, 0.940, 0.821, 0.505, 0.933, 0.828, 0.513, 0.926, 0.834,
|
| 1122 |
+
0.520, 0.919, 0.840, 0.527, 0.913, 0.847, 0.534, 0.906, 0.853, 0.541,
|
| 1123 |
+
0.899, 0.860, 0.548, 0.893, 0.866, 0.554, 0.886, 0.873, 0.560, 0.880,
|
| 1124 |
+
0.879, 0.565, 0.873, 0.885, 0.570, 0.866, 0.891, 0.575, 0.859, 0.897,
|
| 1125 |
+
0.580, 0.852, 0.903, 0.585, 0.845, 0.909, 0.589, 0.838, 0.915, 0.592,
|
| 1126 |
+
0.830, 0.921, 0.596, 0.822, 0.926, 0.599, 0.814, 0.931, 0.601, 0.805,
|
| 1127 |
+
0.936, 0.604, 0.797, 0.941, 0.606, 0.787, 0.946, 0.607, 0.778, 0.950,
|
| 1128 |
+
0.608, 0.768, 0.955, 0.609, 0.757, 0.958, 0.609, 0.746, 0.962, 0.609,
|
| 1129 |
+
0.735, 0.965, 0.609, 0.723, 0.968, 0.608, 0.710, 0.971, 0.607, 0.698,
|
| 1130 |
+
0.974, 0.605, 0.684, 0.976, 0.603, 0.670, 0.977, 0.601, 0.656, 0.979,
|
| 1131 |
+
0.598, 0.641, 0.980, 0.596, 0.626, 0.980, 0.592, 0.610, 0.981, 0.589,
|
| 1132 |
+
0.594, 0.981, 0.585, 0.577, 0.980, 0.581, 0.560, 0.980, 0.577, 0.543,
|
| 1133 |
+
0.979, 0.572, 0.526, 0.977, 0.568, 0.508, 0.976, 0.563, 0.490, 0.974,
|
| 1134 |
+
0.558, 0.471, 0.972, 0.552, 0.453, 0.969, 0.547, 0.434, 0.967, 0.541,
|
| 1135 |
+
0.415, 0.964, 0.536, 0.396, 0.961, 0.530, 0.377, 0.958, 0.524, 0.357,
|
| 1136 |
+
0.954, 0.518, 0.337, 0.950, 0.512, 0.317, 0.947, 0.505, 0.297, 0.943,
|
| 1137 |
+
0.499, 0.276, 0.938, 0.493, 0.255, 0.934, 0.486, 0.234, 0.930, 0.480,
|
| 1138 |
+
0.211, 0.925, 0.473, 0.188, 0.920, 0.466, 0.164, 0.916, 0.459, 0.137,
|
| 1139 |
+
0.787, 0.440, 0.975, 0.793, 0.450, 0.967, 0.799, 0.459, 0.959, 0.806,
|
| 1140 |
+
0.468, 0.952, 0.812, 0.476, 0.944, 0.818, 0.485, 0.937, 0.824, 0.493,
|
| 1141 |
+
0.930, 0.831, 0.500, 0.923, 0.837, 0.508, 0.916, 0.843, 0.515, 0.909,
|
| 1142 |
+
0.850, 0.522, 0.902, 0.856, 0.528, 0.895, 0.862, 0.535, 0.888, 0.868,
|
| 1143 |
+
0.541, 0.881, 0.874, 0.547, 0.875, 0.881, 0.552, 0.868, 0.887, 0.557,
|
| 1144 |
+
0.861, 0.893, 0.562, 0.853, 0.899, 0.567, 0.846, 0.904, 0.571, 0.839,
|
| 1145 |
+
0.910, 0.575, 0.831, 0.916, 0.579, 0.823, 0.921, 0.582, 0.815, 0.926,
|
| 1146 |
+
0.585, 0.807, 0.932, 0.587, 0.798, 0.937, 0.590, 0.789, 0.941, 0.591,
|
| 1147 |
+
0.780, 0.946, 0.593, 0.770, 0.950, 0.594, 0.760, 0.954, 0.595, 0.749,
|
| 1148 |
+
0.958, 0.595, 0.738, 0.962, 0.595, 0.727, 0.965, 0.595, 0.715, 0.968,
|
| 1149 |
+
0.594, 0.702, 0.970, 0.593, 0.689, 0.973, 0.591, 0.676, 0.975, 0.589,
|
| 1150 |
+
0.662, 0.976, 0.587, 0.648, 0.978, 0.585, 0.633, 0.979, 0.582, 0.618,
|
| 1151 |
+
0.980, 0.579, 0.602, 0.980, 0.575, 0.586, 0.980, 0.572, 0.570, 0.980,
|
| 1152 |
+
0.568, 0.553, 0.979, 0.564, 0.536, 0.978, 0.559, 0.518, 0.977, 0.555,
|
| 1153 |
+
0.501, 0.975, 0.550, 0.483, 0.974, 0.545, 0.465, 0.972, 0.540, 0.447,
|
| 1154 |
+
0.969, 0.535, 0.428, 0.967, 0.529, 0.409, 0.964, 0.524, 0.390, 0.961,
|
| 1155 |
+
0.518, 0.371, 0.958, 0.512, 0.352, 0.954, 0.506, 0.332, 0.951, 0.500,
|
| 1156 |
+
0.312, 0.947, 0.494, 0.292, 0.943, 0.488, 0.272, 0.939, 0.481, 0.251,
|
| 1157 |
+
0.935, 0.475, 0.229, 0.931, 0.469, 0.207, 0.926, 0.462, 0.184, 0.921,
|
| 1158 |
+
0.455, 0.159, 0.917, 0.449, 0.133, 0.791, 0.427, 0.973, 0.797, 0.437,
|
| 1159 |
+
0.964, 0.803, 0.446, 0.957, 0.809, 0.455, 0.949, 0.815, 0.464, 0.941,
|
| 1160 |
+
0.821, 0.472, 0.934, 0.827, 0.480, 0.926, 0.834, 0.488, 0.919, 0.840,
|
| 1161 |
+
0.495, 0.912, 0.846, 0.502, 0.905, 0.852, 0.509, 0.898, 0.858, 0.515,
|
| 1162 |
+
0.891, 0.864, 0.522, 0.884, 0.870, 0.528, 0.877, 0.876, 0.533, 0.870,
|
| 1163 |
+
0.882, 0.539, 0.862, 0.888, 0.544, 0.855, 0.894, 0.549, 0.848, 0.900,
|
| 1164 |
+
0.553, 0.840, 0.906, 0.557, 0.833, 0.911, 0.561, 0.825, 0.916, 0.565,
|
| 1165 |
+
0.817, 0.922, 0.568, 0.808, 0.927, 0.571, 0.800, 0.932, 0.573, 0.791,
|
| 1166 |
+
0.937, 0.575, 0.782, 0.941, 0.577, 0.772, 0.946, 0.579, 0.762, 0.950,
|
| 1167 |
+
0.580, 0.752, 0.954, 0.580, 0.741, 0.958, 0.581, 0.730, 0.961, 0.581,
|
| 1168 |
+
0.718, 0.964, 0.580, 0.706, 0.967, 0.580, 0.694, 0.970, 0.578, 0.681,
|
| 1169 |
+
0.972, 0.577, 0.667, 0.974, 0.575, 0.654, 0.976, 0.573, 0.639, 0.977,
|
| 1170 |
+
0.571, 0.625, 0.978, 0.568, 0.610, 0.979, 0.565, 0.594, 0.979, 0.562,
|
| 1171 |
+
0.578, 0.979, 0.558, 0.562, 0.979, 0.554, 0.545, 0.978, 0.550, 0.529,
|
| 1172 |
+
0.977, 0.546, 0.511, 0.976, 0.542, 0.494, 0.975, 0.537, 0.476, 0.973,
|
| 1173 |
+
0.532, 0.458, 0.971, 0.527, 0.440, 0.969, 0.522, 0.422, 0.967, 0.517,
|
| 1174 |
+
0.403, 0.964, 0.511, 0.385, 0.961, 0.506, 0.366, 0.958, 0.500, 0.347,
|
| 1175 |
+
0.955, 0.494, 0.327, 0.951, 0.488, 0.307, 0.947, 0.482, 0.287, 0.944,
|
| 1176 |
+
0.476, 0.267, 0.940, 0.470, 0.246, 0.935, 0.464, 0.225, 0.931, 0.458,
|
| 1177 |
+
0.203, 0.927, 0.451, 0.180, 0.922, 0.445, 0.155, 0.917, 0.438, 0.129,
|
| 1178 |
+
0.795, 0.413, 0.970, 0.801, 0.423, 0.962, 0.807, 0.433, 0.954, 0.813,
|
| 1179 |
+
0.442, 0.946, 0.818, 0.450, 0.938, 0.824, 0.459, 0.930, 0.830, 0.467,
|
| 1180 |
+
0.923, 0.836, 0.474, 0.915, 0.842, 0.482, 0.908, 0.848, 0.489, 0.901,
|
| 1181 |
+
0.854, 0.496, 0.894, 0.860, 0.502, 0.886, 0.866, 0.508, 0.879, 0.872,
|
| 1182 |
+
0.514, 0.872, 0.878, 0.520, 0.864, 0.884, 0.525, 0.857, 0.890, 0.530,
|
| 1183 |
+
0.850, 0.895, 0.535, 0.842, 0.901, 0.539, 0.834, 0.906, 0.543, 0.826,
|
| 1184 |
+
0.912, 0.547, 0.818, 0.917, 0.551, 0.810, 0.922, 0.554, 0.801, 0.927,
|
| 1185 |
+
0.557, 0.793, 0.932, 0.559, 0.783, 0.937, 0.561, 0.774, 0.941, 0.563,
|
| 1186 |
+
0.764, 0.946, 0.564, 0.754, 0.950, 0.565, 0.744, 0.953, 0.566, 0.733,
|
| 1187 |
+
0.957, 0.566, 0.722, 0.960, 0.566, 0.710, 0.963, 0.566, 0.698, 0.966,
|
| 1188 |
+
0.565, 0.685, 0.969, 0.564, 0.673, 0.971, 0.563, 0.659, 0.973, 0.561,
|
| 1189 |
+
0.645, 0.975, 0.559, 0.631, 0.976, 0.557, 0.617, 0.977, 0.554, 0.602,
|
| 1190 |
+
0.978, 0.551, 0.586, 0.978, 0.548, 0.571, 0.978, 0.545, 0.554, 0.978,
|
| 1191 |
+
0.541, 0.538, 0.977, 0.537, 0.521, 0.977, 0.533, 0.504, 0.976, 0.529,
|
| 1192 |
+
0.487, 0.974, 0.524, 0.470, 0.973, 0.519, 0.452, 0.971, 0.515, 0.434,
|
| 1193 |
+
0.969, 0.510, 0.416, 0.966, 0.504, 0.398, 0.964, 0.499, 0.379, 0.961,
|
| 1194 |
+
0.494, 0.360, 0.958, 0.488, 0.341, 0.955, 0.482, 0.322, 0.951, 0.477,
|
| 1195 |
+
0.302, 0.948, 0.471, 0.283, 0.944, 0.465, 0.262, 0.940, 0.459, 0.242,
|
| 1196 |
+
0.936, 0.452, 0.220, 0.932, 0.446, 0.198, 0.927, 0.440, 0.175, 0.923,
|
| 1197 |
+
0.434, 0.151, 0.918, 0.427, 0.124, 0.799, 0.399, 0.968, 0.804, 0.409,
|
| 1198 |
+
0.959, 0.810, 0.419, 0.951, 0.816, 0.428, 0.943, 0.822, 0.437, 0.935,
|
| 1199 |
+
0.827, 0.445, 0.927, 0.833, 0.453, 0.919, 0.839, 0.461, 0.912, 0.845,
|
| 1200 |
+
0.468, 0.904, 0.851, 0.475, 0.897, 0.857, 0.482, 0.889, 0.862, 0.489,
|
| 1201 |
+
0.882, 0.868, 0.495, 0.874, 0.874, 0.501, 0.867, 0.880, 0.506, 0.859,
|
| 1202 |
+
0.885, 0.511, 0.852, 0.891, 0.516, 0.844, 0.897, 0.521, 0.836, 0.902,
|
| 1203 |
+
0.525, 0.828, 0.907, 0.529, 0.820, 0.913, 0.533, 0.812, 0.918, 0.537,
|
| 1204 |
+
0.803, 0.923, 0.540, 0.794, 0.928, 0.542, 0.785, 0.932, 0.545, 0.776,
|
| 1205 |
+
0.937, 0.547, 0.767, 0.941, 0.549, 0.757, 0.945, 0.550, 0.747, 0.949,
|
| 1206 |
+
0.551, 0.736, 0.953, 0.552, 0.725, 0.956, 0.552, 0.714, 0.960, 0.552,
|
| 1207 |
+
0.702, 0.963, 0.552, 0.690, 0.965, 0.551, 0.677, 0.968, 0.550, 0.664,
|
| 1208 |
+
0.970, 0.549, 0.651, 0.972, 0.547, 0.637, 0.974, 0.545, 0.623, 0.975,
|
| 1209 |
+
0.543, 0.609, 0.976, 0.540, 0.594, 0.977, 0.537, 0.578, 0.977, 0.534,
|
| 1210 |
+
0.563, 0.977, 0.531, 0.547, 0.977, 0.527, 0.531, 0.976, 0.524, 0.514,
|
| 1211 |
+
0.976, 0.520, 0.497, 0.975, 0.516, 0.480, 0.973, 0.511, 0.463, 0.972,
|
| 1212 |
+
0.507, 0.446, 0.970, 0.502, 0.428, 0.968, 0.497, 0.410, 0.966, 0.492,
|
| 1213 |
+
0.392, 0.963, 0.487, 0.373, 0.960, 0.481, 0.355, 0.957, 0.476, 0.336,
|
| 1214 |
+
0.954, 0.470, 0.317, 0.951, 0.465, 0.297, 0.947, 0.459, 0.278, 0.944,
|
| 1215 |
+
0.453, 0.258, 0.940, 0.447, 0.237, 0.936, 0.441, 0.216, 0.932, 0.435,
|
| 1216 |
+
0.194, 0.927, 0.429, 0.171, 0.923, 0.422, 0.147, 0.918, 0.416, 0.120,
|
| 1217 |
+
0.802, 0.385, 0.965, 0.808, 0.395, 0.957, 0.813, 0.405, 0.948, 0.819,
|
| 1218 |
+
0.414, 0.940, 0.825, 0.423, 0.932, 0.830, 0.431, 0.924, 0.836, 0.439,
|
| 1219 |
+
0.916, 0.842, 0.447, 0.908, 0.847, 0.454, 0.900, 0.853, 0.462, 0.892,
|
| 1220 |
+
0.859, 0.468, 0.885, 0.864, 0.475, 0.877, 0.870, 0.481, 0.869, 0.876,
|
| 1221 |
+
0.487, 0.862, 0.881, 0.492, 0.854, 0.887, 0.498, 0.846, 0.892, 0.502,
|
| 1222 |
+
0.838, 0.898, 0.507, 0.830, 0.903, 0.511, 0.822, 0.908, 0.515, 0.814,
|
| 1223 |
+
0.913, 0.519, 0.805, 0.918, 0.522, 0.797, 0.923, 0.525, 0.788, 0.928,
|
| 1224 |
+
0.528, 0.778, 0.932, 0.530, 0.769, 0.937, 0.532, 0.759, 0.941, 0.534,
|
| 1225 |
+
0.749, 0.945, 0.535, 0.739, 0.949, 0.536, 0.728, 0.952, 0.537, 0.717,
|
| 1226 |
+
0.956, 0.537, 0.706, 0.959, 0.537, 0.694, 0.962, 0.537, 0.682, 0.964,
|
| 1227 |
+
0.536, 0.669, 0.967, 0.536, 0.656, 0.969, 0.534, 0.643, 0.971, 0.533,
|
| 1228 |
+
0.629, 0.972, 0.531, 0.615, 0.974, 0.529, 0.601, 0.975, 0.526, 0.586,
|
| 1229 |
+
0.975, 0.523, 0.571, 0.976, 0.521, 0.555, 0.976, 0.517, 0.540, 0.976,
|
| 1230 |
+
0.514, 0.523, 0.975, 0.510, 0.507, 0.975, 0.506, 0.490, 0.974, 0.502,
|
| 1231 |
+
0.474, 0.972, 0.498, 0.456, 0.971, 0.494, 0.439, 0.969, 0.489, 0.421,
|
| 1232 |
+
0.967, 0.484, 0.404, 0.965, 0.479, 0.386, 0.963, 0.474, 0.367, 0.960,
|
| 1233 |
+
0.469, 0.349, 0.957, 0.464, 0.330, 0.954, 0.458, 0.311, 0.951, 0.453,
|
| 1234 |
+
0.292, 0.947, 0.447, 0.273, 0.944, 0.441, 0.253, 0.940, 0.435, 0.232,
|
| 1235 |
+
0.936, 0.429, 0.211, 0.932, 0.423, 0.190, 0.927, 0.417, 0.167, 0.923,
|
| 1236 |
+
0.411, 0.142, 0.919, 0.405, 0.116, 0.806, 0.370, 0.963, 0.811, 0.380,
|
| 1237 |
+
0.954, 0.816, 0.390, 0.945, 0.822, 0.399, 0.937, 0.827, 0.408, 0.929,
|
| 1238 |
+
0.833, 0.417, 0.920, 0.838, 0.425, 0.912, 0.844, 0.433, 0.904, 0.850,
|
| 1239 |
+
0.440, 0.896, 0.855, 0.447, 0.888, 0.861, 0.454, 0.880, 0.866, 0.461,
|
| 1240 |
+
0.872, 0.872, 0.467, 0.865, 0.877, 0.473, 0.857, 0.883, 0.478, 0.849,
|
| 1241 |
+
0.888, 0.483, 0.841, 0.893, 0.488, 0.833, 0.899, 0.493, 0.824, 0.904,
|
| 1242 |
+
0.497, 0.816, 0.909, 0.501, 0.807, 0.914, 0.505, 0.799, 0.919, 0.508,
|
| 1243 |
+
0.790, 0.923, 0.511, 0.781, 0.928, 0.514, 0.771, 0.932, 0.516, 0.762,
|
| 1244 |
+
0.937, 0.518, 0.752, 0.941, 0.520, 0.742, 0.945, 0.521, 0.731, 0.948,
|
| 1245 |
+
0.522, 0.720, 0.952, 0.523, 0.709, 0.955, 0.523, 0.698, 0.958, 0.523,
|
| 1246 |
+
0.686, 0.961, 0.523, 0.674, 0.964, 0.522, 0.661, 0.966, 0.521, 0.648,
|
| 1247 |
+
0.968, 0.520, 0.635, 0.970, 0.518, 0.621, 0.971, 0.517, 0.607, 0.972,
|
| 1248 |
+
0.514, 0.593, 0.973, 0.512, 0.578, 0.974, 0.509, 0.563, 0.975, 0.507,
|
| 1249 |
+
0.548, 0.975, 0.503, 0.532, 0.975, 0.500, 0.516, 0.974, 0.497, 0.500,
|
| 1250 |
+
0.974, 0.493, 0.483, 0.973, 0.489, 0.467, 0.971, 0.485, 0.450, 0.970,
|
| 1251 |
+
0.480, 0.433, 0.968, 0.476, 0.415, 0.966, 0.471, 0.397, 0.964, 0.466,
|
| 1252 |
+
0.380, 0.962, 0.461, 0.362, 0.959, 0.456, 0.343, 0.956, 0.451, 0.325,
|
| 1253 |
+
0.953, 0.446, 0.306, 0.950, 0.440, 0.287, 0.947, 0.435, 0.268, 0.943,
|
| 1254 |
+
0.429, 0.248, 0.939, 0.423, 0.228, 0.936, 0.417, 0.207, 0.931, 0.411,
|
| 1255 |
+
0.185, 0.927, 0.405, 0.162, 0.923, 0.399, 0.138, 0.918, 0.393, 0.111,
|
| 1256 |
+
0.809, 0.354, 0.960, 0.814, 0.364, 0.951, 0.819, 0.375, 0.942, 0.825,
|
| 1257 |
+
0.384, 0.934, 0.830, 0.393, 0.925, 0.835, 0.402, 0.917, 0.841, 0.410,
|
| 1258 |
+
0.908, 0.846, 0.418, 0.900, 0.852, 0.426, 0.892, 0.857, 0.433, 0.884,
|
| 1259 |
+
0.863, 0.440, 0.876, 0.868, 0.446, 0.868, 0.873, 0.452, 0.860, 0.879,
|
| 1260 |
+
0.458, 0.852, 0.884, 0.464, 0.843, 0.889, 0.469, 0.835, 0.894, 0.474,
|
| 1261 |
+
0.827, 0.899, 0.478, 0.818, 0.904, 0.483, 0.810, 0.909, 0.486, 0.801,
|
| 1262 |
+
0.914, 0.490, 0.792, 0.919, 0.493, 0.783, 0.923, 0.496, 0.774, 0.928,
|
| 1263 |
+
0.499, 0.764, 0.932, 0.501, 0.755, 0.936, 0.503, 0.745, 0.940, 0.505,
|
| 1264 |
+
0.734, 0.944, 0.506, 0.724, 0.948, 0.507, 0.713, 0.951, 0.508, 0.701,
|
| 1265 |
+
0.954, 0.508, 0.690, 0.957, 0.508, 0.678, 0.960, 0.508, 0.666, 0.962,
|
| 1266 |
+
0.507, 0.653, 0.965, 0.507, 0.640, 0.967, 0.505, 0.627, 0.968, 0.504,
|
| 1267 |
+
0.613, 0.970, 0.502, 0.599, 0.971, 0.500, 0.585, 0.972, 0.498, 0.570,
|
| 1268 |
+
0.973, 0.495, 0.555, 0.973, 0.493, 0.540, 0.973, 0.490, 0.525, 0.973,
|
| 1269 |
+
0.486, 0.509, 0.973, 0.483, 0.493, 0.972, 0.479, 0.476, 0.971, 0.475,
|
| 1270 |
+
0.460, 0.970, 0.471, 0.443, 0.969, 0.467, 0.426, 0.967, 0.463, 0.409,
|
| 1271 |
+
0.965, 0.458, 0.391, 0.963, 0.453, 0.374, 0.961, 0.449, 0.356, 0.958,
|
| 1272 |
+
0.444, 0.338, 0.956, 0.438, 0.319, 0.953, 0.433, 0.301, 0.949, 0.428,
|
| 1273 |
+
0.282, 0.946, 0.422, 0.263, 0.943, 0.417, 0.243, 0.939, 0.411, 0.223,
|
| 1274 |
+
0.935, 0.405, 0.202, 0.931, 0.399, 0.181, 0.927, 0.393, 0.158, 0.923,
|
| 1275 |
+
0.387, 0.134, 0.918, 0.381, 0.107,
|
| 1276 |
+
]).reshape((65, 65, 3))
|
| 1277 |
+
|
| 1278 |
+
BiOrangeBlue = np.array(
|
| 1279 |
+
[0.000, 0.000, 0.000, 0.000, 0.062, 0.125, 0.000, 0.125, 0.250, 0.000,
|
| 1280 |
+
0.188, 0.375, 0.000, 0.250, 0.500, 0.000, 0.312, 0.625, 0.000, 0.375,
|
| 1281 |
+
0.750, 0.000, 0.438, 0.875, 0.000, 0.500, 1.000, 0.125, 0.062, 0.000,
|
| 1282 |
+
0.125, 0.125, 0.125, 0.125, 0.188, 0.250, 0.125, 0.250, 0.375, 0.125,
|
| 1283 |
+
0.312, 0.500, 0.125, 0.375, 0.625, 0.125, 0.438, 0.750, 0.125, 0.500,
|
| 1284 |
+
0.875, 0.125, 0.562, 1.000, 0.250, 0.125, 0.000, 0.250, 0.188, 0.125,
|
| 1285 |
+
0.250, 0.250, 0.250, 0.250, 0.312, 0.375, 0.250, 0.375, 0.500, 0.250,
|
| 1286 |
+
0.438, 0.625, 0.250, 0.500, 0.750, 0.250, 0.562, 0.875, 0.250, 0.625,
|
| 1287 |
+
1.000, 0.375, 0.188, 0.000, 0.375, 0.250, 0.125, 0.375, 0.312, 0.250,
|
| 1288 |
+
0.375, 0.375, 0.375, 0.375, 0.438, 0.500, 0.375, 0.500, 0.625, 0.375,
|
| 1289 |
+
0.562, 0.750, 0.375, 0.625, 0.875, 0.375, 0.688, 1.000, 0.500, 0.250,
|
| 1290 |
+
0.000, 0.500, 0.312, 0.125, 0.500, 0.375, 0.250, 0.500, 0.438, 0.375,
|
| 1291 |
+
0.500, 0.500, 0.500, 0.500, 0.562, 0.625, 0.500, 0.625, 0.750, 0.500,
|
| 1292 |
+
0.688, 0.875, 0.500, 0.750, 1.000, 0.625, 0.312, 0.000, 0.625, 0.375,
|
| 1293 |
+
0.125, 0.625, 0.438, 0.250, 0.625, 0.500, 0.375, 0.625, 0.562, 0.500,
|
| 1294 |
+
0.625, 0.625, 0.625, 0.625, 0.688, 0.750, 0.625, 0.750, 0.875, 0.625,
|
| 1295 |
+
0.812, 1.000, 0.750, 0.375, 0.000, 0.750, 0.438, 0.125, 0.750, 0.500,
|
| 1296 |
+
0.250, 0.750, 0.562, 0.375, 0.750, 0.625, 0.500, 0.750, 0.688, 0.625,
|
| 1297 |
+
0.750, 0.750, 0.750, 0.750, 0.812, 0.875, 0.750, 0.875, 1.000, 0.875,
|
| 1298 |
+
0.438, 0.000, 0.875, 0.500, 0.125, 0.875, 0.562, 0.250, 0.875, 0.625,
|
| 1299 |
+
0.375, 0.875, 0.688, 0.500, 0.875, 0.750, 0.625, 0.875, 0.812, 0.750,
|
| 1300 |
+
0.875, 0.875, 0.875, 0.875, 0.938, 1.000, 1.000, 0.500, 0.000, 1.000,
|
| 1301 |
+
0.562, 0.125, 1.000, 0.625, 0.250, 1.000, 0.688, 0.375, 1.000, 0.750,
|
| 1302 |
+
0.500, 1.000, 0.812, 0.625, 1.000, 0.875, 0.750, 1.000, 0.938, 0.875,
|
| 1303 |
+
1.000, 1.000, 1.000,
|
| 1304 |
+
]).reshape((9, 9, 3))
|
| 1305 |
+
|
| 1306 |
+
cmaps = {
|
| 1307 |
+
"BiPeak": SegmentedBivarColormap(
|
| 1308 |
+
BiPeak, 256, "square", (.5, .5), name="BiPeak"),
|
| 1309 |
+
"BiOrangeBlue": SegmentedBivarColormap(
|
| 1310 |
+
BiOrangeBlue, 256, "square", (0, 0), name="BiOrangeBlue"),
|
| 1311 |
+
"BiCone": SegmentedBivarColormap(BiPeak, 256, "circle", (.5, .5), name="BiCone"),
|
| 1312 |
+
}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_listed.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_cm_multivar.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# auto-generated by https://github.com/trygvrad/multivariate_colormaps
|
| 2 |
+
# date: 2024-05-28
|
| 3 |
+
|
| 4 |
+
from .colors import LinearSegmentedColormap, MultivarColormap
|
| 5 |
+
import matplotlib as mpl
|
| 6 |
+
_LUTSIZE = mpl.rcParams['image.lut']
|
| 7 |
+
|
| 8 |
+
_2VarAddA0_data = [[0.000, 0.000, 0.000],
|
| 9 |
+
[0.020, 0.026, 0.031],
|
| 10 |
+
[0.049, 0.068, 0.085],
|
| 11 |
+
[0.075, 0.107, 0.135],
|
| 12 |
+
[0.097, 0.144, 0.183],
|
| 13 |
+
[0.116, 0.178, 0.231],
|
| 14 |
+
[0.133, 0.212, 0.279],
|
| 15 |
+
[0.148, 0.244, 0.326],
|
| 16 |
+
[0.161, 0.276, 0.374],
|
| 17 |
+
[0.173, 0.308, 0.422],
|
| 18 |
+
[0.182, 0.339, 0.471],
|
| 19 |
+
[0.190, 0.370, 0.521],
|
| 20 |
+
[0.197, 0.400, 0.572],
|
| 21 |
+
[0.201, 0.431, 0.623],
|
| 22 |
+
[0.204, 0.461, 0.675],
|
| 23 |
+
[0.204, 0.491, 0.728],
|
| 24 |
+
[0.202, 0.520, 0.783],
|
| 25 |
+
[0.197, 0.549, 0.838],
|
| 26 |
+
[0.187, 0.577, 0.895]]
|
| 27 |
+
|
| 28 |
+
_2VarAddA1_data = [[0.000, 0.000, 0.000],
|
| 29 |
+
[0.030, 0.023, 0.018],
|
| 30 |
+
[0.079, 0.060, 0.043],
|
| 31 |
+
[0.125, 0.093, 0.065],
|
| 32 |
+
[0.170, 0.123, 0.083],
|
| 33 |
+
[0.213, 0.151, 0.098],
|
| 34 |
+
[0.255, 0.177, 0.110],
|
| 35 |
+
[0.298, 0.202, 0.120],
|
| 36 |
+
[0.341, 0.226, 0.128],
|
| 37 |
+
[0.384, 0.249, 0.134],
|
| 38 |
+
[0.427, 0.271, 0.138],
|
| 39 |
+
[0.472, 0.292, 0.141],
|
| 40 |
+
[0.517, 0.313, 0.142],
|
| 41 |
+
[0.563, 0.333, 0.141],
|
| 42 |
+
[0.610, 0.353, 0.139],
|
| 43 |
+
[0.658, 0.372, 0.134],
|
| 44 |
+
[0.708, 0.390, 0.127],
|
| 45 |
+
[0.759, 0.407, 0.118],
|
| 46 |
+
[0.813, 0.423, 0.105]]
|
| 47 |
+
|
| 48 |
+
_2VarSubA0_data = [[1.000, 1.000, 1.000],
|
| 49 |
+
[0.959, 0.973, 0.986],
|
| 50 |
+
[0.916, 0.948, 0.974],
|
| 51 |
+
[0.874, 0.923, 0.965],
|
| 52 |
+
[0.832, 0.899, 0.956],
|
| 53 |
+
[0.790, 0.875, 0.948],
|
| 54 |
+
[0.748, 0.852, 0.940],
|
| 55 |
+
[0.707, 0.829, 0.934],
|
| 56 |
+
[0.665, 0.806, 0.927],
|
| 57 |
+
[0.624, 0.784, 0.921],
|
| 58 |
+
[0.583, 0.762, 0.916],
|
| 59 |
+
[0.541, 0.740, 0.910],
|
| 60 |
+
[0.500, 0.718, 0.905],
|
| 61 |
+
[0.457, 0.697, 0.901],
|
| 62 |
+
[0.414, 0.675, 0.896],
|
| 63 |
+
[0.369, 0.652, 0.892],
|
| 64 |
+
[0.320, 0.629, 0.888],
|
| 65 |
+
[0.266, 0.604, 0.884],
|
| 66 |
+
[0.199, 0.574, 0.881]]
|
| 67 |
+
|
| 68 |
+
_2VarSubA1_data = [[1.000, 1.000, 1.000],
|
| 69 |
+
[0.982, 0.967, 0.955],
|
| 70 |
+
[0.966, 0.935, 0.908],
|
| 71 |
+
[0.951, 0.902, 0.860],
|
| 72 |
+
[0.937, 0.870, 0.813],
|
| 73 |
+
[0.923, 0.838, 0.765],
|
| 74 |
+
[0.910, 0.807, 0.718],
|
| 75 |
+
[0.898, 0.776, 0.671],
|
| 76 |
+
[0.886, 0.745, 0.624],
|
| 77 |
+
[0.874, 0.714, 0.577],
|
| 78 |
+
[0.862, 0.683, 0.530],
|
| 79 |
+
[0.851, 0.653, 0.483],
|
| 80 |
+
[0.841, 0.622, 0.435],
|
| 81 |
+
[0.831, 0.592, 0.388],
|
| 82 |
+
[0.822, 0.561, 0.340],
|
| 83 |
+
[0.813, 0.530, 0.290],
|
| 84 |
+
[0.806, 0.498, 0.239],
|
| 85 |
+
[0.802, 0.464, 0.184],
|
| 86 |
+
[0.801, 0.426, 0.119]]
|
| 87 |
+
|
| 88 |
+
_3VarAddA0_data = [[0.000, 0.000, 0.000],
|
| 89 |
+
[0.018, 0.023, 0.028],
|
| 90 |
+
[0.040, 0.056, 0.071],
|
| 91 |
+
[0.059, 0.087, 0.110],
|
| 92 |
+
[0.074, 0.114, 0.147],
|
| 93 |
+
[0.086, 0.139, 0.183],
|
| 94 |
+
[0.095, 0.163, 0.219],
|
| 95 |
+
[0.101, 0.187, 0.255],
|
| 96 |
+
[0.105, 0.209, 0.290],
|
| 97 |
+
[0.107, 0.230, 0.326],
|
| 98 |
+
[0.105, 0.251, 0.362],
|
| 99 |
+
[0.101, 0.271, 0.398],
|
| 100 |
+
[0.091, 0.291, 0.434],
|
| 101 |
+
[0.075, 0.309, 0.471],
|
| 102 |
+
[0.046, 0.325, 0.507],
|
| 103 |
+
[0.021, 0.341, 0.546],
|
| 104 |
+
[0.021, 0.363, 0.584],
|
| 105 |
+
[0.022, 0.385, 0.622],
|
| 106 |
+
[0.023, 0.408, 0.661]]
|
| 107 |
+
|
| 108 |
+
_3VarAddA1_data = [[0.000, 0.000, 0.000],
|
| 109 |
+
[0.020, 0.024, 0.016],
|
| 110 |
+
[0.047, 0.058, 0.034],
|
| 111 |
+
[0.072, 0.088, 0.048],
|
| 112 |
+
[0.093, 0.116, 0.059],
|
| 113 |
+
[0.113, 0.142, 0.067],
|
| 114 |
+
[0.131, 0.167, 0.071],
|
| 115 |
+
[0.149, 0.190, 0.074],
|
| 116 |
+
[0.166, 0.213, 0.074],
|
| 117 |
+
[0.182, 0.235, 0.072],
|
| 118 |
+
[0.198, 0.256, 0.068],
|
| 119 |
+
[0.215, 0.276, 0.061],
|
| 120 |
+
[0.232, 0.296, 0.051],
|
| 121 |
+
[0.249, 0.314, 0.037],
|
| 122 |
+
[0.270, 0.330, 0.018],
|
| 123 |
+
[0.288, 0.347, 0.000],
|
| 124 |
+
[0.302, 0.369, 0.000],
|
| 125 |
+
[0.315, 0.391, 0.000],
|
| 126 |
+
[0.328, 0.414, 0.000]]
|
| 127 |
+
|
| 128 |
+
_3VarAddA2_data = [[0.000, 0.000, 0.000],
|
| 129 |
+
[0.029, 0.020, 0.023],
|
| 130 |
+
[0.072, 0.045, 0.055],
|
| 131 |
+
[0.111, 0.067, 0.084],
|
| 132 |
+
[0.148, 0.085, 0.109],
|
| 133 |
+
[0.184, 0.101, 0.133],
|
| 134 |
+
[0.219, 0.115, 0.155],
|
| 135 |
+
[0.254, 0.127, 0.176],
|
| 136 |
+
[0.289, 0.138, 0.195],
|
| 137 |
+
[0.323, 0.147, 0.214],
|
| 138 |
+
[0.358, 0.155, 0.232],
|
| 139 |
+
[0.393, 0.161, 0.250],
|
| 140 |
+
[0.429, 0.166, 0.267],
|
| 141 |
+
[0.467, 0.169, 0.283],
|
| 142 |
+
[0.507, 0.168, 0.298],
|
| 143 |
+
[0.546, 0.168, 0.313],
|
| 144 |
+
[0.580, 0.172, 0.328],
|
| 145 |
+
[0.615, 0.175, 0.341],
|
| 146 |
+
[0.649, 0.178, 0.355]]
|
| 147 |
+
|
| 148 |
+
cmaps = {
|
| 149 |
+
name: LinearSegmentedColormap.from_list(name, data, _LUTSIZE) for name, data in [
|
| 150 |
+
('2VarAddA0', _2VarAddA0_data),
|
| 151 |
+
('2VarAddA1', _2VarAddA1_data),
|
| 152 |
+
('2VarSubA0', _2VarSubA0_data),
|
| 153 |
+
('2VarSubA1', _2VarSubA1_data),
|
| 154 |
+
('3VarAddA0', _3VarAddA0_data),
|
| 155 |
+
('3VarAddA1', _3VarAddA1_data),
|
| 156 |
+
('3VarAddA2', _3VarAddA2_data),
|
| 157 |
+
]}
|
| 158 |
+
|
| 159 |
+
cmap_families = {
|
| 160 |
+
'2VarAddA': MultivarColormap([cmaps[f'2VarAddA{i}'] for i in range(2)],
|
| 161 |
+
'sRGB_add', name='2VarAddA'),
|
| 162 |
+
'2VarSubA': MultivarColormap([cmaps[f'2VarSubA{i}'] for i in range(2)],
|
| 163 |
+
'sRGB_sub', name='2VarSubA'),
|
| 164 |
+
'3VarAddA': MultivarColormap([cmaps[f'3VarAddA{i}'] for i in range(3)],
|
| 165 |
+
'sRGB_add', name='3VarAddA'),
|
| 166 |
+
}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_color_data.py
ADDED
|
@@ -0,0 +1,1141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BASE_COLORS = {
|
| 2 |
+
'b': (0, 0, 1), # blue
|
| 3 |
+
'g': (0, 0.5, 0), # green
|
| 4 |
+
'r': (1, 0, 0), # red
|
| 5 |
+
'c': (0, 0.75, 0.75), # cyan
|
| 6 |
+
'm': (0.75, 0, 0.75), # magenta
|
| 7 |
+
'y': (0.75, 0.75, 0), # yellow
|
| 8 |
+
'k': (0, 0, 0), # black
|
| 9 |
+
'w': (1, 1, 1), # white
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
# These colors are from Tableau
|
| 14 |
+
TABLEAU_COLORS = {
|
| 15 |
+
'tab:blue': '#1f77b4',
|
| 16 |
+
'tab:orange': '#ff7f0e',
|
| 17 |
+
'tab:green': '#2ca02c',
|
| 18 |
+
'tab:red': '#d62728',
|
| 19 |
+
'tab:purple': '#9467bd',
|
| 20 |
+
'tab:brown': '#8c564b',
|
| 21 |
+
'tab:pink': '#e377c2',
|
| 22 |
+
'tab:gray': '#7f7f7f',
|
| 23 |
+
'tab:olive': '#bcbd22',
|
| 24 |
+
'tab:cyan': '#17becf',
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# This mapping of color names -> hex values is taken from
|
| 29 |
+
# a survey run by Randall Munroe see:
|
| 30 |
+
# https://blog.xkcd.com/2010/05/03/color-survey-results/
|
| 31 |
+
# for more details. The results are hosted at
|
| 32 |
+
# https://xkcd.com/color/rgb/
|
| 33 |
+
# and also available as a text file at
|
| 34 |
+
# https://xkcd.com/color/rgb.txt
|
| 35 |
+
#
|
| 36 |
+
# License: https://creativecommons.org/publicdomain/zero/1.0/
|
| 37 |
+
XKCD_COLORS = {
|
| 38 |
+
'cloudy blue': '#acc2d9',
|
| 39 |
+
'dark pastel green': '#56ae57',
|
| 40 |
+
'dust': '#b2996e',
|
| 41 |
+
'electric lime': '#a8ff04',
|
| 42 |
+
'fresh green': '#69d84f',
|
| 43 |
+
'light eggplant': '#894585',
|
| 44 |
+
'nasty green': '#70b23f',
|
| 45 |
+
'really light blue': '#d4ffff',
|
| 46 |
+
'tea': '#65ab7c',
|
| 47 |
+
'warm purple': '#952e8f',
|
| 48 |
+
'yellowish tan': '#fcfc81',
|
| 49 |
+
'cement': '#a5a391',
|
| 50 |
+
'dark grass green': '#388004',
|
| 51 |
+
'dusty teal': '#4c9085',
|
| 52 |
+
'grey teal': '#5e9b8a',
|
| 53 |
+
'macaroni and cheese': '#efb435',
|
| 54 |
+
'pinkish tan': '#d99b82',
|
| 55 |
+
'spruce': '#0a5f38',
|
| 56 |
+
'strong blue': '#0c06f7',
|
| 57 |
+
'toxic green': '#61de2a',
|
| 58 |
+
'windows blue': '#3778bf',
|
| 59 |
+
'blue blue': '#2242c7',
|
| 60 |
+
'blue with a hint of purple': '#533cc6',
|
| 61 |
+
'booger': '#9bb53c',
|
| 62 |
+
'bright sea green': '#05ffa6',
|
| 63 |
+
'dark green blue': '#1f6357',
|
| 64 |
+
'deep turquoise': '#017374',
|
| 65 |
+
'green teal': '#0cb577',
|
| 66 |
+
'strong pink': '#ff0789',
|
| 67 |
+
'bland': '#afa88b',
|
| 68 |
+
'deep aqua': '#08787f',
|
| 69 |
+
'lavender pink': '#dd85d7',
|
| 70 |
+
'light moss green': '#a6c875',
|
| 71 |
+
'light seafoam green': '#a7ffb5',
|
| 72 |
+
'olive yellow': '#c2b709',
|
| 73 |
+
'pig pink': '#e78ea5',
|
| 74 |
+
'deep lilac': '#966ebd',
|
| 75 |
+
'desert': '#ccad60',
|
| 76 |
+
'dusty lavender': '#ac86a8',
|
| 77 |
+
'purpley grey': '#947e94',
|
| 78 |
+
'purply': '#983fb2',
|
| 79 |
+
'candy pink': '#ff63e9',
|
| 80 |
+
'light pastel green': '#b2fba5',
|
| 81 |
+
'boring green': '#63b365',
|
| 82 |
+
'kiwi green': '#8ee53f',
|
| 83 |
+
'light grey green': '#b7e1a1',
|
| 84 |
+
'orange pink': '#ff6f52',
|
| 85 |
+
'tea green': '#bdf8a3',
|
| 86 |
+
'very light brown': '#d3b683',
|
| 87 |
+
'egg shell': '#fffcc4',
|
| 88 |
+
'eggplant purple': '#430541',
|
| 89 |
+
'powder pink': '#ffb2d0',
|
| 90 |
+
'reddish grey': '#997570',
|
| 91 |
+
'baby shit brown': '#ad900d',
|
| 92 |
+
'liliac': '#c48efd',
|
| 93 |
+
'stormy blue': '#507b9c',
|
| 94 |
+
'ugly brown': '#7d7103',
|
| 95 |
+
'custard': '#fffd78',
|
| 96 |
+
'darkish pink': '#da467d',
|
| 97 |
+
'deep brown': '#410200',
|
| 98 |
+
'greenish beige': '#c9d179',
|
| 99 |
+
'manilla': '#fffa86',
|
| 100 |
+
'off blue': '#5684ae',
|
| 101 |
+
'battleship grey': '#6b7c85',
|
| 102 |
+
'browny green': '#6f6c0a',
|
| 103 |
+
'bruise': '#7e4071',
|
| 104 |
+
'kelley green': '#009337',
|
| 105 |
+
'sickly yellow': '#d0e429',
|
| 106 |
+
'sunny yellow': '#fff917',
|
| 107 |
+
'azul': '#1d5dec',
|
| 108 |
+
'darkgreen': '#054907',
|
| 109 |
+
'green/yellow': '#b5ce08',
|
| 110 |
+
'lichen': '#8fb67b',
|
| 111 |
+
'light light green': '#c8ffb0',
|
| 112 |
+
'pale gold': '#fdde6c',
|
| 113 |
+
'sun yellow': '#ffdf22',
|
| 114 |
+
'tan green': '#a9be70',
|
| 115 |
+
'burple': '#6832e3',
|
| 116 |
+
'butterscotch': '#fdb147',
|
| 117 |
+
'toupe': '#c7ac7d',
|
| 118 |
+
'dark cream': '#fff39a',
|
| 119 |
+
'indian red': '#850e04',
|
| 120 |
+
'light lavendar': '#efc0fe',
|
| 121 |
+
'poison green': '#40fd14',
|
| 122 |
+
'baby puke green': '#b6c406',
|
| 123 |
+
'bright yellow green': '#9dff00',
|
| 124 |
+
'charcoal grey': '#3c4142',
|
| 125 |
+
'squash': '#f2ab15',
|
| 126 |
+
'cinnamon': '#ac4f06',
|
| 127 |
+
'light pea green': '#c4fe82',
|
| 128 |
+
'radioactive green': '#2cfa1f',
|
| 129 |
+
'raw sienna': '#9a6200',
|
| 130 |
+
'baby purple': '#ca9bf7',
|
| 131 |
+
'cocoa': '#875f42',
|
| 132 |
+
'light royal blue': '#3a2efe',
|
| 133 |
+
'orangeish': '#fd8d49',
|
| 134 |
+
'rust brown': '#8b3103',
|
| 135 |
+
'sand brown': '#cba560',
|
| 136 |
+
'swamp': '#698339',
|
| 137 |
+
'tealish green': '#0cdc73',
|
| 138 |
+
'burnt siena': '#b75203',
|
| 139 |
+
'camo': '#7f8f4e',
|
| 140 |
+
'dusk blue': '#26538d',
|
| 141 |
+
'fern': '#63a950',
|
| 142 |
+
'old rose': '#c87f89',
|
| 143 |
+
'pale light green': '#b1fc99',
|
| 144 |
+
'peachy pink': '#ff9a8a',
|
| 145 |
+
'rosy pink': '#f6688e',
|
| 146 |
+
'light bluish green': '#76fda8',
|
| 147 |
+
'light bright green': '#53fe5c',
|
| 148 |
+
'light neon green': '#4efd54',
|
| 149 |
+
'light seafoam': '#a0febf',
|
| 150 |
+
'tiffany blue': '#7bf2da',
|
| 151 |
+
'washed out green': '#bcf5a6',
|
| 152 |
+
'browny orange': '#ca6b02',
|
| 153 |
+
'nice blue': '#107ab0',
|
| 154 |
+
'sapphire': '#2138ab',
|
| 155 |
+
'greyish teal': '#719f91',
|
| 156 |
+
'orangey yellow': '#fdb915',
|
| 157 |
+
'parchment': '#fefcaf',
|
| 158 |
+
'straw': '#fcf679',
|
| 159 |
+
'very dark brown': '#1d0200',
|
| 160 |
+
'terracota': '#cb6843',
|
| 161 |
+
'ugly blue': '#31668a',
|
| 162 |
+
'clear blue': '#247afd',
|
| 163 |
+
'creme': '#ffffb6',
|
| 164 |
+
'foam green': '#90fda9',
|
| 165 |
+
'grey/green': '#86a17d',
|
| 166 |
+
'light gold': '#fddc5c',
|
| 167 |
+
'seafoam blue': '#78d1b6',
|
| 168 |
+
'topaz': '#13bbaf',
|
| 169 |
+
'violet pink': '#fb5ffc',
|
| 170 |
+
'wintergreen': '#20f986',
|
| 171 |
+
'yellow tan': '#ffe36e',
|
| 172 |
+
'dark fuchsia': '#9d0759',
|
| 173 |
+
'indigo blue': '#3a18b1',
|
| 174 |
+
'light yellowish green': '#c2ff89',
|
| 175 |
+
'pale magenta': '#d767ad',
|
| 176 |
+
'rich purple': '#720058',
|
| 177 |
+
'sunflower yellow': '#ffda03',
|
| 178 |
+
'green/blue': '#01c08d',
|
| 179 |
+
'leather': '#ac7434',
|
| 180 |
+
'racing green': '#014600',
|
| 181 |
+
'vivid purple': '#9900fa',
|
| 182 |
+
'dark royal blue': '#02066f',
|
| 183 |
+
'hazel': '#8e7618',
|
| 184 |
+
'muted pink': '#d1768f',
|
| 185 |
+
'booger green': '#96b403',
|
| 186 |
+
'canary': '#fdff63',
|
| 187 |
+
'cool grey': '#95a3a6',
|
| 188 |
+
'dark taupe': '#7f684e',
|
| 189 |
+
'darkish purple': '#751973',
|
| 190 |
+
'true green': '#089404',
|
| 191 |
+
'coral pink': '#ff6163',
|
| 192 |
+
'dark sage': '#598556',
|
| 193 |
+
'dark slate blue': '#214761',
|
| 194 |
+
'flat blue': '#3c73a8',
|
| 195 |
+
'mushroom': '#ba9e88',
|
| 196 |
+
'rich blue': '#021bf9',
|
| 197 |
+
'dirty purple': '#734a65',
|
| 198 |
+
'greenblue': '#23c48b',
|
| 199 |
+
'icky green': '#8fae22',
|
| 200 |
+
'light khaki': '#e6f2a2',
|
| 201 |
+
'warm blue': '#4b57db',
|
| 202 |
+
'dark hot pink': '#d90166',
|
| 203 |
+
'deep sea blue': '#015482',
|
| 204 |
+
'carmine': '#9d0216',
|
| 205 |
+
'dark yellow green': '#728f02',
|
| 206 |
+
'pale peach': '#ffe5ad',
|
| 207 |
+
'plum purple': '#4e0550',
|
| 208 |
+
'golden rod': '#f9bc08',
|
| 209 |
+
'neon red': '#ff073a',
|
| 210 |
+
'old pink': '#c77986',
|
| 211 |
+
'very pale blue': '#d6fffe',
|
| 212 |
+
'blood orange': '#fe4b03',
|
| 213 |
+
'grapefruit': '#fd5956',
|
| 214 |
+
'sand yellow': '#fce166',
|
| 215 |
+
'clay brown': '#b2713d',
|
| 216 |
+
'dark blue grey': '#1f3b4d',
|
| 217 |
+
'flat green': '#699d4c',
|
| 218 |
+
'light green blue': '#56fca2',
|
| 219 |
+
'warm pink': '#fb5581',
|
| 220 |
+
'dodger blue': '#3e82fc',
|
| 221 |
+
'gross green': '#a0bf16',
|
| 222 |
+
'ice': '#d6fffa',
|
| 223 |
+
'metallic blue': '#4f738e',
|
| 224 |
+
'pale salmon': '#ffb19a',
|
| 225 |
+
'sap green': '#5c8b15',
|
| 226 |
+
'algae': '#54ac68',
|
| 227 |
+
'bluey grey': '#89a0b0',
|
| 228 |
+
'greeny grey': '#7ea07a',
|
| 229 |
+
'highlighter green': '#1bfc06',
|
| 230 |
+
'light light blue': '#cafffb',
|
| 231 |
+
'light mint': '#b6ffbb',
|
| 232 |
+
'raw umber': '#a75e09',
|
| 233 |
+
'vivid blue': '#152eff',
|
| 234 |
+
'deep lavender': '#8d5eb7',
|
| 235 |
+
'dull teal': '#5f9e8f',
|
| 236 |
+
'light greenish blue': '#63f7b4',
|
| 237 |
+
'mud green': '#606602',
|
| 238 |
+
'pinky': '#fc86aa',
|
| 239 |
+
'red wine': '#8c0034',
|
| 240 |
+
'shit green': '#758000',
|
| 241 |
+
'tan brown': '#ab7e4c',
|
| 242 |
+
'darkblue': '#030764',
|
| 243 |
+
'rosa': '#fe86a4',
|
| 244 |
+
'lipstick': '#d5174e',
|
| 245 |
+
'pale mauve': '#fed0fc',
|
| 246 |
+
'claret': '#680018',
|
| 247 |
+
'dandelion': '#fedf08',
|
| 248 |
+
'orangered': '#fe420f',
|
| 249 |
+
'poop green': '#6f7c00',
|
| 250 |
+
'ruby': '#ca0147',
|
| 251 |
+
'dark': '#1b2431',
|
| 252 |
+
'greenish turquoise': '#00fbb0',
|
| 253 |
+
'pastel red': '#db5856',
|
| 254 |
+
'piss yellow': '#ddd618',
|
| 255 |
+
'bright cyan': '#41fdfe',
|
| 256 |
+
'dark coral': '#cf524e',
|
| 257 |
+
'algae green': '#21c36f',
|
| 258 |
+
'darkish red': '#a90308',
|
| 259 |
+
'reddy brown': '#6e1005',
|
| 260 |
+
'blush pink': '#fe828c',
|
| 261 |
+
'camouflage green': '#4b6113',
|
| 262 |
+
'lawn green': '#4da409',
|
| 263 |
+
'putty': '#beae8a',
|
| 264 |
+
'vibrant blue': '#0339f8',
|
| 265 |
+
'dark sand': '#a88f59',
|
| 266 |
+
'purple/blue': '#5d21d0',
|
| 267 |
+
'saffron': '#feb209',
|
| 268 |
+
'twilight': '#4e518b',
|
| 269 |
+
'warm brown': '#964e02',
|
| 270 |
+
'bluegrey': '#85a3b2',
|
| 271 |
+
'bubble gum pink': '#ff69af',
|
| 272 |
+
'duck egg blue': '#c3fbf4',
|
| 273 |
+
'greenish cyan': '#2afeb7',
|
| 274 |
+
'petrol': '#005f6a',
|
| 275 |
+
'royal': '#0c1793',
|
| 276 |
+
'butter': '#ffff81',
|
| 277 |
+
'dusty orange': '#f0833a',
|
| 278 |
+
'off yellow': '#f1f33f',
|
| 279 |
+
'pale olive green': '#b1d27b',
|
| 280 |
+
'orangish': '#fc824a',
|
| 281 |
+
'leaf': '#71aa34',
|
| 282 |
+
'light blue grey': '#b7c9e2',
|
| 283 |
+
'dried blood': '#4b0101',
|
| 284 |
+
'lightish purple': '#a552e6',
|
| 285 |
+
'rusty red': '#af2f0d',
|
| 286 |
+
'lavender blue': '#8b88f8',
|
| 287 |
+
'light grass green': '#9af764',
|
| 288 |
+
'light mint green': '#a6fbb2',
|
| 289 |
+
'sunflower': '#ffc512',
|
| 290 |
+
'velvet': '#750851',
|
| 291 |
+
'brick orange': '#c14a09',
|
| 292 |
+
'lightish red': '#fe2f4a',
|
| 293 |
+
'pure blue': '#0203e2',
|
| 294 |
+
'twilight blue': '#0a437a',
|
| 295 |
+
'violet red': '#a50055',
|
| 296 |
+
'yellowy brown': '#ae8b0c',
|
| 297 |
+
'carnation': '#fd798f',
|
| 298 |
+
'muddy yellow': '#bfac05',
|
| 299 |
+
'dark seafoam green': '#3eaf76',
|
| 300 |
+
'deep rose': '#c74767',
|
| 301 |
+
'dusty red': '#b9484e',
|
| 302 |
+
'grey/blue': '#647d8e',
|
| 303 |
+
'lemon lime': '#bffe28',
|
| 304 |
+
'purple/pink': '#d725de',
|
| 305 |
+
'brown yellow': '#b29705',
|
| 306 |
+
'purple brown': '#673a3f',
|
| 307 |
+
'wisteria': '#a87dc2',
|
| 308 |
+
'banana yellow': '#fafe4b',
|
| 309 |
+
'lipstick red': '#c0022f',
|
| 310 |
+
'water blue': '#0e87cc',
|
| 311 |
+
'brown grey': '#8d8468',
|
| 312 |
+
'vibrant purple': '#ad03de',
|
| 313 |
+
'baby green': '#8cff9e',
|
| 314 |
+
'barf green': '#94ac02',
|
| 315 |
+
'eggshell blue': '#c4fff7',
|
| 316 |
+
'sandy yellow': '#fdee73',
|
| 317 |
+
'cool green': '#33b864',
|
| 318 |
+
'pale': '#fff9d0',
|
| 319 |
+
'blue/grey': '#758da3',
|
| 320 |
+
'hot magenta': '#f504c9',
|
| 321 |
+
'greyblue': '#77a1b5',
|
| 322 |
+
'purpley': '#8756e4',
|
| 323 |
+
'baby shit green': '#889717',
|
| 324 |
+
'brownish pink': '#c27e79',
|
| 325 |
+
'dark aquamarine': '#017371',
|
| 326 |
+
'diarrhea': '#9f8303',
|
| 327 |
+
'light mustard': '#f7d560',
|
| 328 |
+
'pale sky blue': '#bdf6fe',
|
| 329 |
+
'turtle green': '#75b84f',
|
| 330 |
+
'bright olive': '#9cbb04',
|
| 331 |
+
'dark grey blue': '#29465b',
|
| 332 |
+
'greeny brown': '#696006',
|
| 333 |
+
'lemon green': '#adf802',
|
| 334 |
+
'light periwinkle': '#c1c6fc',
|
| 335 |
+
'seaweed green': '#35ad6b',
|
| 336 |
+
'sunshine yellow': '#fffd37',
|
| 337 |
+
'ugly purple': '#a442a0',
|
| 338 |
+
'medium pink': '#f36196',
|
| 339 |
+
'puke brown': '#947706',
|
| 340 |
+
'very light pink': '#fff4f2',
|
| 341 |
+
'viridian': '#1e9167',
|
| 342 |
+
'bile': '#b5c306',
|
| 343 |
+
'faded yellow': '#feff7f',
|
| 344 |
+
'very pale green': '#cffdbc',
|
| 345 |
+
'vibrant green': '#0add08',
|
| 346 |
+
'bright lime': '#87fd05',
|
| 347 |
+
'spearmint': '#1ef876',
|
| 348 |
+
'light aquamarine': '#7bfdc7',
|
| 349 |
+
'light sage': '#bcecac',
|
| 350 |
+
'yellowgreen': '#bbf90f',
|
| 351 |
+
'baby poo': '#ab9004',
|
| 352 |
+
'dark seafoam': '#1fb57a',
|
| 353 |
+
'deep teal': '#00555a',
|
| 354 |
+
'heather': '#a484ac',
|
| 355 |
+
'rust orange': '#c45508',
|
| 356 |
+
'dirty blue': '#3f829d',
|
| 357 |
+
'fern green': '#548d44',
|
| 358 |
+
'bright lilac': '#c95efb',
|
| 359 |
+
'weird green': '#3ae57f',
|
| 360 |
+
'peacock blue': '#016795',
|
| 361 |
+
'avocado green': '#87a922',
|
| 362 |
+
'faded orange': '#f0944d',
|
| 363 |
+
'grape purple': '#5d1451',
|
| 364 |
+
'hot green': '#25ff29',
|
| 365 |
+
'lime yellow': '#d0fe1d',
|
| 366 |
+
'mango': '#ffa62b',
|
| 367 |
+
'shamrock': '#01b44c',
|
| 368 |
+
'bubblegum': '#ff6cb5',
|
| 369 |
+
'purplish brown': '#6b4247',
|
| 370 |
+
'vomit yellow': '#c7c10c',
|
| 371 |
+
'pale cyan': '#b7fffa',
|
| 372 |
+
'key lime': '#aeff6e',
|
| 373 |
+
'tomato red': '#ec2d01',
|
| 374 |
+
'lightgreen': '#76ff7b',
|
| 375 |
+
'merlot': '#730039',
|
| 376 |
+
'night blue': '#040348',
|
| 377 |
+
'purpleish pink': '#df4ec8',
|
| 378 |
+
'apple': '#6ecb3c',
|
| 379 |
+
'baby poop green': '#8f9805',
|
| 380 |
+
'green apple': '#5edc1f',
|
| 381 |
+
'heliotrope': '#d94ff5',
|
| 382 |
+
'yellow/green': '#c8fd3d',
|
| 383 |
+
'almost black': '#070d0d',
|
| 384 |
+
'cool blue': '#4984b8',
|
| 385 |
+
'leafy green': '#51b73b',
|
| 386 |
+
'mustard brown': '#ac7e04',
|
| 387 |
+
'dusk': '#4e5481',
|
| 388 |
+
'dull brown': '#876e4b',
|
| 389 |
+
'frog green': '#58bc08',
|
| 390 |
+
'vivid green': '#2fef10',
|
| 391 |
+
'bright light green': '#2dfe54',
|
| 392 |
+
'fluro green': '#0aff02',
|
| 393 |
+
'kiwi': '#9cef43',
|
| 394 |
+
'seaweed': '#18d17b',
|
| 395 |
+
'navy green': '#35530a',
|
| 396 |
+
'ultramarine blue': '#1805db',
|
| 397 |
+
'iris': '#6258c4',
|
| 398 |
+
'pastel orange': '#ff964f',
|
| 399 |
+
'yellowish orange': '#ffab0f',
|
| 400 |
+
'perrywinkle': '#8f8ce7',
|
| 401 |
+
'tealish': '#24bca8',
|
| 402 |
+
'dark plum': '#3f012c',
|
| 403 |
+
'pear': '#cbf85f',
|
| 404 |
+
'pinkish orange': '#ff724c',
|
| 405 |
+
'midnight purple': '#280137',
|
| 406 |
+
'light urple': '#b36ff6',
|
| 407 |
+
'dark mint': '#48c072',
|
| 408 |
+
'greenish tan': '#bccb7a',
|
| 409 |
+
'light burgundy': '#a8415b',
|
| 410 |
+
'turquoise blue': '#06b1c4',
|
| 411 |
+
'ugly pink': '#cd7584',
|
| 412 |
+
'sandy': '#f1da7a',
|
| 413 |
+
'electric pink': '#ff0490',
|
| 414 |
+
'muted purple': '#805b87',
|
| 415 |
+
'mid green': '#50a747',
|
| 416 |
+
'greyish': '#a8a495',
|
| 417 |
+
'neon yellow': '#cfff04',
|
| 418 |
+
'banana': '#ffff7e',
|
| 419 |
+
'carnation pink': '#ff7fa7',
|
| 420 |
+
'tomato': '#ef4026',
|
| 421 |
+
'sea': '#3c9992',
|
| 422 |
+
'muddy brown': '#886806',
|
| 423 |
+
'turquoise green': '#04f489',
|
| 424 |
+
'buff': '#fef69e',
|
| 425 |
+
'fawn': '#cfaf7b',
|
| 426 |
+
'muted blue': '#3b719f',
|
| 427 |
+
'pale rose': '#fdc1c5',
|
| 428 |
+
'dark mint green': '#20c073',
|
| 429 |
+
'amethyst': '#9b5fc0',
|
| 430 |
+
'blue/green': '#0f9b8e',
|
| 431 |
+
'chestnut': '#742802',
|
| 432 |
+
'sick green': '#9db92c',
|
| 433 |
+
'pea': '#a4bf20',
|
| 434 |
+
'rusty orange': '#cd5909',
|
| 435 |
+
'stone': '#ada587',
|
| 436 |
+
'rose red': '#be013c',
|
| 437 |
+
'pale aqua': '#b8ffeb',
|
| 438 |
+
'deep orange': '#dc4d01',
|
| 439 |
+
'earth': '#a2653e',
|
| 440 |
+
'mossy green': '#638b27',
|
| 441 |
+
'grassy green': '#419c03',
|
| 442 |
+
'pale lime green': '#b1ff65',
|
| 443 |
+
'light grey blue': '#9dbcd4',
|
| 444 |
+
'pale grey': '#fdfdfe',
|
| 445 |
+
'asparagus': '#77ab56',
|
| 446 |
+
'blueberry': '#464196',
|
| 447 |
+
'purple red': '#990147',
|
| 448 |
+
'pale lime': '#befd73',
|
| 449 |
+
'greenish teal': '#32bf84',
|
| 450 |
+
'caramel': '#af6f09',
|
| 451 |
+
'deep magenta': '#a0025c',
|
| 452 |
+
'light peach': '#ffd8b1',
|
| 453 |
+
'milk chocolate': '#7f4e1e',
|
| 454 |
+
'ocher': '#bf9b0c',
|
| 455 |
+
'off green': '#6ba353',
|
| 456 |
+
'purply pink': '#f075e6',
|
| 457 |
+
'lightblue': '#7bc8f6',
|
| 458 |
+
'dusky blue': '#475f94',
|
| 459 |
+
'golden': '#f5bf03',
|
| 460 |
+
'light beige': '#fffeb6',
|
| 461 |
+
'butter yellow': '#fffd74',
|
| 462 |
+
'dusky purple': '#895b7b',
|
| 463 |
+
'french blue': '#436bad',
|
| 464 |
+
'ugly yellow': '#d0c101',
|
| 465 |
+
'greeny yellow': '#c6f808',
|
| 466 |
+
'orangish red': '#f43605',
|
| 467 |
+
'shamrock green': '#02c14d',
|
| 468 |
+
'orangish brown': '#b25f03',
|
| 469 |
+
'tree green': '#2a7e19',
|
| 470 |
+
'deep violet': '#490648',
|
| 471 |
+
'gunmetal': '#536267',
|
| 472 |
+
'blue/purple': '#5a06ef',
|
| 473 |
+
'cherry': '#cf0234',
|
| 474 |
+
'sandy brown': '#c4a661',
|
| 475 |
+
'warm grey': '#978a84',
|
| 476 |
+
'dark indigo': '#1f0954',
|
| 477 |
+
'midnight': '#03012d',
|
| 478 |
+
'bluey green': '#2bb179',
|
| 479 |
+
'grey pink': '#c3909b',
|
| 480 |
+
'soft purple': '#a66fb5',
|
| 481 |
+
'blood': '#770001',
|
| 482 |
+
'brown red': '#922b05',
|
| 483 |
+
'medium grey': '#7d7f7c',
|
| 484 |
+
'berry': '#990f4b',
|
| 485 |
+
'poo': '#8f7303',
|
| 486 |
+
'purpley pink': '#c83cb9',
|
| 487 |
+
'light salmon': '#fea993',
|
| 488 |
+
'snot': '#acbb0d',
|
| 489 |
+
'easter purple': '#c071fe',
|
| 490 |
+
'light yellow green': '#ccfd7f',
|
| 491 |
+
'dark navy blue': '#00022e',
|
| 492 |
+
'drab': '#828344',
|
| 493 |
+
'light rose': '#ffc5cb',
|
| 494 |
+
'rouge': '#ab1239',
|
| 495 |
+
'purplish red': '#b0054b',
|
| 496 |
+
'slime green': '#99cc04',
|
| 497 |
+
'baby poop': '#937c00',
|
| 498 |
+
'irish green': '#019529',
|
| 499 |
+
'pink/purple': '#ef1de7',
|
| 500 |
+
'dark navy': '#000435',
|
| 501 |
+
'greeny blue': '#42b395',
|
| 502 |
+
'light plum': '#9d5783',
|
| 503 |
+
'pinkish grey': '#c8aca9',
|
| 504 |
+
'dirty orange': '#c87606',
|
| 505 |
+
'rust red': '#aa2704',
|
| 506 |
+
'pale lilac': '#e4cbff',
|
| 507 |
+
'orangey red': '#fa4224',
|
| 508 |
+
'primary blue': '#0804f9',
|
| 509 |
+
'kermit green': '#5cb200',
|
| 510 |
+
'brownish purple': '#76424e',
|
| 511 |
+
'murky green': '#6c7a0e',
|
| 512 |
+
'wheat': '#fbdd7e',
|
| 513 |
+
'very dark purple': '#2a0134',
|
| 514 |
+
'bottle green': '#044a05',
|
| 515 |
+
'watermelon': '#fd4659',
|
| 516 |
+
'deep sky blue': '#0d75f8',
|
| 517 |
+
'fire engine red': '#fe0002',
|
| 518 |
+
'yellow ochre': '#cb9d06',
|
| 519 |
+
'pumpkin orange': '#fb7d07',
|
| 520 |
+
'pale olive': '#b9cc81',
|
| 521 |
+
'light lilac': '#edc8ff',
|
| 522 |
+
'lightish green': '#61e160',
|
| 523 |
+
'carolina blue': '#8ab8fe',
|
| 524 |
+
'mulberry': '#920a4e',
|
| 525 |
+
'shocking pink': '#fe02a2',
|
| 526 |
+
'auburn': '#9a3001',
|
| 527 |
+
'bright lime green': '#65fe08',
|
| 528 |
+
'celadon': '#befdb7',
|
| 529 |
+
'pinkish brown': '#b17261',
|
| 530 |
+
'poo brown': '#885f01',
|
| 531 |
+
'bright sky blue': '#02ccfe',
|
| 532 |
+
'celery': '#c1fd95',
|
| 533 |
+
'dirt brown': '#836539',
|
| 534 |
+
'strawberry': '#fb2943',
|
| 535 |
+
'dark lime': '#84b701',
|
| 536 |
+
'copper': '#b66325',
|
| 537 |
+
'medium brown': '#7f5112',
|
| 538 |
+
'muted green': '#5fa052',
|
| 539 |
+
"robin's egg": '#6dedfd',
|
| 540 |
+
'bright aqua': '#0bf9ea',
|
| 541 |
+
'bright lavender': '#c760ff',
|
| 542 |
+
'ivory': '#ffffcb',
|
| 543 |
+
'very light purple': '#f6cefc',
|
| 544 |
+
'light navy': '#155084',
|
| 545 |
+
'pink red': '#f5054f',
|
| 546 |
+
'olive brown': '#645403',
|
| 547 |
+
'poop brown': '#7a5901',
|
| 548 |
+
'mustard green': '#a8b504',
|
| 549 |
+
'ocean green': '#3d9973',
|
| 550 |
+
'very dark blue': '#000133',
|
| 551 |
+
'dusty green': '#76a973',
|
| 552 |
+
'light navy blue': '#2e5a88',
|
| 553 |
+
'minty green': '#0bf77d',
|
| 554 |
+
'adobe': '#bd6c48',
|
| 555 |
+
'barney': '#ac1db8',
|
| 556 |
+
'jade green': '#2baf6a',
|
| 557 |
+
'bright light blue': '#26f7fd',
|
| 558 |
+
'light lime': '#aefd6c',
|
| 559 |
+
'dark khaki': '#9b8f55',
|
| 560 |
+
'orange yellow': '#ffad01',
|
| 561 |
+
'ocre': '#c69c04',
|
| 562 |
+
'maize': '#f4d054',
|
| 563 |
+
'faded pink': '#de9dac',
|
| 564 |
+
'british racing green': '#05480d',
|
| 565 |
+
'sandstone': '#c9ae74',
|
| 566 |
+
'mud brown': '#60460f',
|
| 567 |
+
'light sea green': '#98f6b0',
|
| 568 |
+
'robin egg blue': '#8af1fe',
|
| 569 |
+
'aqua marine': '#2ee8bb',
|
| 570 |
+
'dark sea green': '#11875d',
|
| 571 |
+
'soft pink': '#fdb0c0',
|
| 572 |
+
'orangey brown': '#b16002',
|
| 573 |
+
'cherry red': '#f7022a',
|
| 574 |
+
'burnt yellow': '#d5ab09',
|
| 575 |
+
'brownish grey': '#86775f',
|
| 576 |
+
'camel': '#c69f59',
|
| 577 |
+
'purplish grey': '#7a687f',
|
| 578 |
+
'marine': '#042e60',
|
| 579 |
+
'greyish pink': '#c88d94',
|
| 580 |
+
'pale turquoise': '#a5fbd5',
|
| 581 |
+
'pastel yellow': '#fffe71',
|
| 582 |
+
'bluey purple': '#6241c7',
|
| 583 |
+
'canary yellow': '#fffe40',
|
| 584 |
+
'faded red': '#d3494e',
|
| 585 |
+
'sepia': '#985e2b',
|
| 586 |
+
'coffee': '#a6814c',
|
| 587 |
+
'bright magenta': '#ff08e8',
|
| 588 |
+
'mocha': '#9d7651',
|
| 589 |
+
'ecru': '#feffca',
|
| 590 |
+
'purpleish': '#98568d',
|
| 591 |
+
'cranberry': '#9e003a',
|
| 592 |
+
'darkish green': '#287c37',
|
| 593 |
+
'brown orange': '#b96902',
|
| 594 |
+
'dusky rose': '#ba6873',
|
| 595 |
+
'melon': '#ff7855',
|
| 596 |
+
'sickly green': '#94b21c',
|
| 597 |
+
'silver': '#c5c9c7',
|
| 598 |
+
'purply blue': '#661aee',
|
| 599 |
+
'purpleish blue': '#6140ef',
|
| 600 |
+
'hospital green': '#9be5aa',
|
| 601 |
+
'shit brown': '#7b5804',
|
| 602 |
+
'mid blue': '#276ab3',
|
| 603 |
+
'amber': '#feb308',
|
| 604 |
+
'easter green': '#8cfd7e',
|
| 605 |
+
'soft blue': '#6488ea',
|
| 606 |
+
'cerulean blue': '#056eee',
|
| 607 |
+
'golden brown': '#b27a01',
|
| 608 |
+
'bright turquoise': '#0ffef9',
|
| 609 |
+
'red pink': '#fa2a55',
|
| 610 |
+
'red purple': '#820747',
|
| 611 |
+
'greyish brown': '#7a6a4f',
|
| 612 |
+
'vermillion': '#f4320c',
|
| 613 |
+
'russet': '#a13905',
|
| 614 |
+
'steel grey': '#6f828a',
|
| 615 |
+
'lighter purple': '#a55af4',
|
| 616 |
+
'bright violet': '#ad0afd',
|
| 617 |
+
'prussian blue': '#004577',
|
| 618 |
+
'slate green': '#658d6d',
|
| 619 |
+
'dirty pink': '#ca7b80',
|
| 620 |
+
'dark blue green': '#005249',
|
| 621 |
+
'pine': '#2b5d34',
|
| 622 |
+
'yellowy green': '#bff128',
|
| 623 |
+
'dark gold': '#b59410',
|
| 624 |
+
'bluish': '#2976bb',
|
| 625 |
+
'darkish blue': '#014182',
|
| 626 |
+
'dull red': '#bb3f3f',
|
| 627 |
+
'pinky red': '#fc2647',
|
| 628 |
+
'bronze': '#a87900',
|
| 629 |
+
'pale teal': '#82cbb2',
|
| 630 |
+
'military green': '#667c3e',
|
| 631 |
+
'barbie pink': '#fe46a5',
|
| 632 |
+
'bubblegum pink': '#fe83cc',
|
| 633 |
+
'pea soup green': '#94a617',
|
| 634 |
+
'dark mustard': '#a88905',
|
| 635 |
+
'shit': '#7f5f00',
|
| 636 |
+
'medium purple': '#9e43a2',
|
| 637 |
+
'very dark green': '#062e03',
|
| 638 |
+
'dirt': '#8a6e45',
|
| 639 |
+
'dusky pink': '#cc7a8b',
|
| 640 |
+
'red violet': '#9e0168',
|
| 641 |
+
'lemon yellow': '#fdff38',
|
| 642 |
+
'pistachio': '#c0fa8b',
|
| 643 |
+
'dull yellow': '#eedc5b',
|
| 644 |
+
'dark lime green': '#7ebd01',
|
| 645 |
+
'denim blue': '#3b5b92',
|
| 646 |
+
'teal blue': '#01889f',
|
| 647 |
+
'lightish blue': '#3d7afd',
|
| 648 |
+
'purpley blue': '#5f34e7',
|
| 649 |
+
'light indigo': '#6d5acf',
|
| 650 |
+
'swamp green': '#748500',
|
| 651 |
+
'brown green': '#706c11',
|
| 652 |
+
'dark maroon': '#3c0008',
|
| 653 |
+
'hot purple': '#cb00f5',
|
| 654 |
+
'dark forest green': '#002d04',
|
| 655 |
+
'faded blue': '#658cbb',
|
| 656 |
+
'drab green': '#749551',
|
| 657 |
+
'light lime green': '#b9ff66',
|
| 658 |
+
'snot green': '#9dc100',
|
| 659 |
+
'yellowish': '#faee66',
|
| 660 |
+
'light blue green': '#7efbb3',
|
| 661 |
+
'bordeaux': '#7b002c',
|
| 662 |
+
'light mauve': '#c292a1',
|
| 663 |
+
'ocean': '#017b92',
|
| 664 |
+
'marigold': '#fcc006',
|
| 665 |
+
'muddy green': '#657432',
|
| 666 |
+
'dull orange': '#d8863b',
|
| 667 |
+
'steel': '#738595',
|
| 668 |
+
'electric purple': '#aa23ff',
|
| 669 |
+
'fluorescent green': '#08ff08',
|
| 670 |
+
'yellowish brown': '#9b7a01',
|
| 671 |
+
'blush': '#f29e8e',
|
| 672 |
+
'soft green': '#6fc276',
|
| 673 |
+
'bright orange': '#ff5b00',
|
| 674 |
+
'lemon': '#fdff52',
|
| 675 |
+
'purple grey': '#866f85',
|
| 676 |
+
'acid green': '#8ffe09',
|
| 677 |
+
'pale lavender': '#eecffe',
|
| 678 |
+
'violet blue': '#510ac9',
|
| 679 |
+
'light forest green': '#4f9153',
|
| 680 |
+
'burnt red': '#9f2305',
|
| 681 |
+
'khaki green': '#728639',
|
| 682 |
+
'cerise': '#de0c62',
|
| 683 |
+
'faded purple': '#916e99',
|
| 684 |
+
'apricot': '#ffb16d',
|
| 685 |
+
'dark olive green': '#3c4d03',
|
| 686 |
+
'grey brown': '#7f7053',
|
| 687 |
+
'green grey': '#77926f',
|
| 688 |
+
'true blue': '#010fcc',
|
| 689 |
+
'pale violet': '#ceaefa',
|
| 690 |
+
'periwinkle blue': '#8f99fb',
|
| 691 |
+
'light sky blue': '#c6fcff',
|
| 692 |
+
'blurple': '#5539cc',
|
| 693 |
+
'green brown': '#544e03',
|
| 694 |
+
'bluegreen': '#017a79',
|
| 695 |
+
'bright teal': '#01f9c6',
|
| 696 |
+
'brownish yellow': '#c9b003',
|
| 697 |
+
'pea soup': '#929901',
|
| 698 |
+
'forest': '#0b5509',
|
| 699 |
+
'barney purple': '#a00498',
|
| 700 |
+
'ultramarine': '#2000b1',
|
| 701 |
+
'purplish': '#94568c',
|
| 702 |
+
'puke yellow': '#c2be0e',
|
| 703 |
+
'bluish grey': '#748b97',
|
| 704 |
+
'dark periwinkle': '#665fd1',
|
| 705 |
+
'dark lilac': '#9c6da5',
|
| 706 |
+
'reddish': '#c44240',
|
| 707 |
+
'light maroon': '#a24857',
|
| 708 |
+
'dusty purple': '#825f87',
|
| 709 |
+
'terra cotta': '#c9643b',
|
| 710 |
+
'avocado': '#90b134',
|
| 711 |
+
'marine blue': '#01386a',
|
| 712 |
+
'teal green': '#25a36f',
|
| 713 |
+
'slate grey': '#59656d',
|
| 714 |
+
'lighter green': '#75fd63',
|
| 715 |
+
'electric green': '#21fc0d',
|
| 716 |
+
'dusty blue': '#5a86ad',
|
| 717 |
+
'golden yellow': '#fec615',
|
| 718 |
+
'bright yellow': '#fffd01',
|
| 719 |
+
'light lavender': '#dfc5fe',
|
| 720 |
+
'umber': '#b26400',
|
| 721 |
+
'poop': '#7f5e00',
|
| 722 |
+
'dark peach': '#de7e5d',
|
| 723 |
+
'jungle green': '#048243',
|
| 724 |
+
'eggshell': '#ffffd4',
|
| 725 |
+
'denim': '#3b638c',
|
| 726 |
+
'yellow brown': '#b79400',
|
| 727 |
+
'dull purple': '#84597e',
|
| 728 |
+
'chocolate brown': '#411900',
|
| 729 |
+
'wine red': '#7b0323',
|
| 730 |
+
'neon blue': '#04d9ff',
|
| 731 |
+
'dirty green': '#667e2c',
|
| 732 |
+
'light tan': '#fbeeac',
|
| 733 |
+
'ice blue': '#d7fffe',
|
| 734 |
+
'cadet blue': '#4e7496',
|
| 735 |
+
'dark mauve': '#874c62',
|
| 736 |
+
'very light blue': '#d5ffff',
|
| 737 |
+
'grey purple': '#826d8c',
|
| 738 |
+
'pastel pink': '#ffbacd',
|
| 739 |
+
'very light green': '#d1ffbd',
|
| 740 |
+
'dark sky blue': '#448ee4',
|
| 741 |
+
'evergreen': '#05472a',
|
| 742 |
+
'dull pink': '#d5869d',
|
| 743 |
+
'aubergine': '#3d0734',
|
| 744 |
+
'mahogany': '#4a0100',
|
| 745 |
+
'reddish orange': '#f8481c',
|
| 746 |
+
'deep green': '#02590f',
|
| 747 |
+
'vomit green': '#89a203',
|
| 748 |
+
'purple pink': '#e03fd8',
|
| 749 |
+
'dusty pink': '#d58a94',
|
| 750 |
+
'faded green': '#7bb274',
|
| 751 |
+
'camo green': '#526525',
|
| 752 |
+
'pinky purple': '#c94cbe',
|
| 753 |
+
'pink purple': '#db4bda',
|
| 754 |
+
'brownish red': '#9e3623',
|
| 755 |
+
'dark rose': '#b5485d',
|
| 756 |
+
'mud': '#735c12',
|
| 757 |
+
'brownish': '#9c6d57',
|
| 758 |
+
'emerald green': '#028f1e',
|
| 759 |
+
'pale brown': '#b1916e',
|
| 760 |
+
'dull blue': '#49759c',
|
| 761 |
+
'burnt umber': '#a0450e',
|
| 762 |
+
'medium green': '#39ad48',
|
| 763 |
+
'clay': '#b66a50',
|
| 764 |
+
'light aqua': '#8cffdb',
|
| 765 |
+
'light olive green': '#a4be5c',
|
| 766 |
+
'brownish orange': '#cb7723',
|
| 767 |
+
'dark aqua': '#05696b',
|
| 768 |
+
'purplish pink': '#ce5dae',
|
| 769 |
+
'dark salmon': '#c85a53',
|
| 770 |
+
'greenish grey': '#96ae8d',
|
| 771 |
+
'jade': '#1fa774',
|
| 772 |
+
'ugly green': '#7a9703',
|
| 773 |
+
'dark beige': '#ac9362',
|
| 774 |
+
'emerald': '#01a049',
|
| 775 |
+
'pale red': '#d9544d',
|
| 776 |
+
'light magenta': '#fa5ff7',
|
| 777 |
+
'sky': '#82cafc',
|
| 778 |
+
'light cyan': '#acfffc',
|
| 779 |
+
'yellow orange': '#fcb001',
|
| 780 |
+
'reddish purple': '#910951',
|
| 781 |
+
'reddish pink': '#fe2c54',
|
| 782 |
+
'orchid': '#c875c4',
|
| 783 |
+
'dirty yellow': '#cdc50a',
|
| 784 |
+
'orange red': '#fd411e',
|
| 785 |
+
'deep red': '#9a0200',
|
| 786 |
+
'orange brown': '#be6400',
|
| 787 |
+
'cobalt blue': '#030aa7',
|
| 788 |
+
'neon pink': '#fe019a',
|
| 789 |
+
'rose pink': '#f7879a',
|
| 790 |
+
'greyish purple': '#887191',
|
| 791 |
+
'raspberry': '#b00149',
|
| 792 |
+
'aqua green': '#12e193',
|
| 793 |
+
'salmon pink': '#fe7b7c',
|
| 794 |
+
'tangerine': '#ff9408',
|
| 795 |
+
'brownish green': '#6a6e09',
|
| 796 |
+
'red brown': '#8b2e16',
|
| 797 |
+
'greenish brown': '#696112',
|
| 798 |
+
'pumpkin': '#e17701',
|
| 799 |
+
'pine green': '#0a481e',
|
| 800 |
+
'charcoal': '#343837',
|
| 801 |
+
'baby pink': '#ffb7ce',
|
| 802 |
+
'cornflower': '#6a79f7',
|
| 803 |
+
'blue violet': '#5d06e9',
|
| 804 |
+
'chocolate': '#3d1c02',
|
| 805 |
+
'greyish green': '#82a67d',
|
| 806 |
+
'scarlet': '#be0119',
|
| 807 |
+
'green yellow': '#c9ff27',
|
| 808 |
+
'dark olive': '#373e02',
|
| 809 |
+
'sienna': '#a9561e',
|
| 810 |
+
'pastel purple': '#caa0ff',
|
| 811 |
+
'terracotta': '#ca6641',
|
| 812 |
+
'aqua blue': '#02d8e9',
|
| 813 |
+
'sage green': '#88b378',
|
| 814 |
+
'blood red': '#980002',
|
| 815 |
+
'deep pink': '#cb0162',
|
| 816 |
+
'grass': '#5cac2d',
|
| 817 |
+
'moss': '#769958',
|
| 818 |
+
'pastel blue': '#a2bffe',
|
| 819 |
+
'bluish green': '#10a674',
|
| 820 |
+
'green blue': '#06b48b',
|
| 821 |
+
'dark tan': '#af884a',
|
| 822 |
+
'greenish blue': '#0b8b87',
|
| 823 |
+
'pale orange': '#ffa756',
|
| 824 |
+
'vomit': '#a2a415',
|
| 825 |
+
'forrest green': '#154406',
|
| 826 |
+
'dark lavender': '#856798',
|
| 827 |
+
'dark violet': '#34013f',
|
| 828 |
+
'purple blue': '#632de9',
|
| 829 |
+
'dark cyan': '#0a888a',
|
| 830 |
+
'olive drab': '#6f7632',
|
| 831 |
+
'pinkish': '#d46a7e',
|
| 832 |
+
'cobalt': '#1e488f',
|
| 833 |
+
'neon purple': '#bc13fe',
|
| 834 |
+
'light turquoise': '#7ef4cc',
|
| 835 |
+
'apple green': '#76cd26',
|
| 836 |
+
'dull green': '#74a662',
|
| 837 |
+
'wine': '#80013f',
|
| 838 |
+
'powder blue': '#b1d1fc',
|
| 839 |
+
'off white': '#ffffe4',
|
| 840 |
+
'electric blue': '#0652ff',
|
| 841 |
+
'dark turquoise': '#045c5a',
|
| 842 |
+
'blue purple': '#5729ce',
|
| 843 |
+
'azure': '#069af3',
|
| 844 |
+
'bright red': '#ff000d',
|
| 845 |
+
'pinkish red': '#f10c45',
|
| 846 |
+
'cornflower blue': '#5170d7',
|
| 847 |
+
'light olive': '#acbf69',
|
| 848 |
+
'grape': '#6c3461',
|
| 849 |
+
'greyish blue': '#5e819d',
|
| 850 |
+
'purplish blue': '#601ef9',
|
| 851 |
+
'yellowish green': '#b0dd16',
|
| 852 |
+
'greenish yellow': '#cdfd02',
|
| 853 |
+
'medium blue': '#2c6fbb',
|
| 854 |
+
'dusty rose': '#c0737a',
|
| 855 |
+
'light violet': '#d6b4fc',
|
| 856 |
+
'midnight blue': '#020035',
|
| 857 |
+
'bluish purple': '#703be7',
|
| 858 |
+
'red orange': '#fd3c06',
|
| 859 |
+
'dark magenta': '#960056',
|
| 860 |
+
'greenish': '#40a368',
|
| 861 |
+
'ocean blue': '#03719c',
|
| 862 |
+
'coral': '#fc5a50',
|
| 863 |
+
'cream': '#ffffc2',
|
| 864 |
+
'reddish brown': '#7f2b0a',
|
| 865 |
+
'burnt sienna': '#b04e0f',
|
| 866 |
+
'brick': '#a03623',
|
| 867 |
+
'sage': '#87ae73',
|
| 868 |
+
'grey green': '#789b73',
|
| 869 |
+
'white': '#ffffff',
|
| 870 |
+
"robin's egg blue": '#98eff9',
|
| 871 |
+
'moss green': '#658b38',
|
| 872 |
+
'steel blue': '#5a7d9a',
|
| 873 |
+
'eggplant': '#380835',
|
| 874 |
+
'light yellow': '#fffe7a',
|
| 875 |
+
'leaf green': '#5ca904',
|
| 876 |
+
'light grey': '#d8dcd6',
|
| 877 |
+
'puke': '#a5a502',
|
| 878 |
+
'pinkish purple': '#d648d7',
|
| 879 |
+
'sea blue': '#047495',
|
| 880 |
+
'pale purple': '#b790d4',
|
| 881 |
+
'slate blue': '#5b7c99',
|
| 882 |
+
'blue grey': '#607c8e',
|
| 883 |
+
'hunter green': '#0b4008',
|
| 884 |
+
'fuchsia': '#ed0dd9',
|
| 885 |
+
'crimson': '#8c000f',
|
| 886 |
+
'pale yellow': '#ffff84',
|
| 887 |
+
'ochre': '#bf9005',
|
| 888 |
+
'mustard yellow': '#d2bd0a',
|
| 889 |
+
'light red': '#ff474c',
|
| 890 |
+
'cerulean': '#0485d1',
|
| 891 |
+
'pale pink': '#ffcfdc',
|
| 892 |
+
'deep blue': '#040273',
|
| 893 |
+
'rust': '#a83c09',
|
| 894 |
+
'light teal': '#90e4c1',
|
| 895 |
+
'slate': '#516572',
|
| 896 |
+
'goldenrod': '#fac205',
|
| 897 |
+
'dark yellow': '#d5b60a',
|
| 898 |
+
'dark grey': '#363737',
|
| 899 |
+
'army green': '#4b5d16',
|
| 900 |
+
'grey blue': '#6b8ba4',
|
| 901 |
+
'seafoam': '#80f9ad',
|
| 902 |
+
'puce': '#a57e52',
|
| 903 |
+
'spring green': '#a9f971',
|
| 904 |
+
'dark orange': '#c65102',
|
| 905 |
+
'sand': '#e2ca76',
|
| 906 |
+
'pastel green': '#b0ff9d',
|
| 907 |
+
'mint': '#9ffeb0',
|
| 908 |
+
'light orange': '#fdaa48',
|
| 909 |
+
'bright pink': '#fe01b1',
|
| 910 |
+
'chartreuse': '#c1f80a',
|
| 911 |
+
'deep purple': '#36013f',
|
| 912 |
+
'dark brown': '#341c02',
|
| 913 |
+
'taupe': '#b9a281',
|
| 914 |
+
'pea green': '#8eab12',
|
| 915 |
+
'puke green': '#9aae07',
|
| 916 |
+
'kelly green': '#02ab2e',
|
| 917 |
+
'seafoam green': '#7af9ab',
|
| 918 |
+
'blue green': '#137e6d',
|
| 919 |
+
'khaki': '#aaa662',
|
| 920 |
+
'burgundy': '#610023',
|
| 921 |
+
'dark teal': '#014d4e',
|
| 922 |
+
'brick red': '#8f1402',
|
| 923 |
+
'royal purple': '#4b006e',
|
| 924 |
+
'plum': '#580f41',
|
| 925 |
+
'mint green': '#8fff9f',
|
| 926 |
+
'gold': '#dbb40c',
|
| 927 |
+
'baby blue': '#a2cffe',
|
| 928 |
+
'yellow green': '#c0fb2d',
|
| 929 |
+
'bright purple': '#be03fd',
|
| 930 |
+
'dark red': '#840000',
|
| 931 |
+
'pale blue': '#d0fefe',
|
| 932 |
+
'grass green': '#3f9b0b',
|
| 933 |
+
'navy': '#01153e',
|
| 934 |
+
'aquamarine': '#04d8b2',
|
| 935 |
+
'burnt orange': '#c04e01',
|
| 936 |
+
'neon green': '#0cff0c',
|
| 937 |
+
'bright blue': '#0165fc',
|
| 938 |
+
'rose': '#cf6275',
|
| 939 |
+
'light pink': '#ffd1df',
|
| 940 |
+
'mustard': '#ceb301',
|
| 941 |
+
'indigo': '#380282',
|
| 942 |
+
'lime': '#aaff32',
|
| 943 |
+
'sea green': '#53fca1',
|
| 944 |
+
'periwinkle': '#8e82fe',
|
| 945 |
+
'dark pink': '#cb416b',
|
| 946 |
+
'olive green': '#677a04',
|
| 947 |
+
'peach': '#ffb07c',
|
| 948 |
+
'pale green': '#c7fdb5',
|
| 949 |
+
'light brown': '#ad8150',
|
| 950 |
+
'hot pink': '#ff028d',
|
| 951 |
+
'black': '#000000',
|
| 952 |
+
'lilac': '#cea2fd',
|
| 953 |
+
'navy blue': '#001146',
|
| 954 |
+
'royal blue': '#0504aa',
|
| 955 |
+
'beige': '#e6daa6',
|
| 956 |
+
'salmon': '#ff796c',
|
| 957 |
+
'olive': '#6e750e',
|
| 958 |
+
'maroon': '#650021',
|
| 959 |
+
'bright green': '#01ff07',
|
| 960 |
+
'dark purple': '#35063e',
|
| 961 |
+
'mauve': '#ae7181',
|
| 962 |
+
'forest green': '#06470c',
|
| 963 |
+
'aqua': '#13eac9',
|
| 964 |
+
'cyan': '#00ffff',
|
| 965 |
+
'tan': '#d1b26f',
|
| 966 |
+
'dark blue': '#00035b',
|
| 967 |
+
'lavender': '#c79fef',
|
| 968 |
+
'turquoise': '#06c2ac',
|
| 969 |
+
'dark green': '#033500',
|
| 970 |
+
'violet': '#9a0eea',
|
| 971 |
+
'light purple': '#bf77f6',
|
| 972 |
+
'lime green': '#89fe05',
|
| 973 |
+
'grey': '#929591',
|
| 974 |
+
'sky blue': '#75bbfd',
|
| 975 |
+
'yellow': '#ffff14',
|
| 976 |
+
'magenta': '#c20078',
|
| 977 |
+
'light green': '#96f97b',
|
| 978 |
+
'orange': '#f97306',
|
| 979 |
+
'teal': '#029386',
|
| 980 |
+
'light blue': '#95d0fc',
|
| 981 |
+
'red': '#e50000',
|
| 982 |
+
'brown': '#653700',
|
| 983 |
+
'pink': '#ff81c0',
|
| 984 |
+
'blue': '#0343df',
|
| 985 |
+
'green': '#15b01a',
|
| 986 |
+
'purple': '#7e1e9c'}
|
| 987 |
+
|
| 988 |
+
# Normalize name to "xkcd:<name>" to avoid name collisions.
|
| 989 |
+
XKCD_COLORS = {'xkcd:' + name: value for name, value in XKCD_COLORS.items()}
|
| 990 |
+
|
| 991 |
+
|
| 992 |
+
# https://drafts.csswg.org/css-color-4/#named-colors
|
| 993 |
+
CSS4_COLORS = {
|
| 994 |
+
'aliceblue': '#F0F8FF',
|
| 995 |
+
'antiquewhite': '#FAEBD7',
|
| 996 |
+
'aqua': '#00FFFF',
|
| 997 |
+
'aquamarine': '#7FFFD4',
|
| 998 |
+
'azure': '#F0FFFF',
|
| 999 |
+
'beige': '#F5F5DC',
|
| 1000 |
+
'bisque': '#FFE4C4',
|
| 1001 |
+
'black': '#000000',
|
| 1002 |
+
'blanchedalmond': '#FFEBCD',
|
| 1003 |
+
'blue': '#0000FF',
|
| 1004 |
+
'blueviolet': '#8A2BE2',
|
| 1005 |
+
'brown': '#A52A2A',
|
| 1006 |
+
'burlywood': '#DEB887',
|
| 1007 |
+
'cadetblue': '#5F9EA0',
|
| 1008 |
+
'chartreuse': '#7FFF00',
|
| 1009 |
+
'chocolate': '#D2691E',
|
| 1010 |
+
'coral': '#FF7F50',
|
| 1011 |
+
'cornflowerblue': '#6495ED',
|
| 1012 |
+
'cornsilk': '#FFF8DC',
|
| 1013 |
+
'crimson': '#DC143C',
|
| 1014 |
+
'cyan': '#00FFFF',
|
| 1015 |
+
'darkblue': '#00008B',
|
| 1016 |
+
'darkcyan': '#008B8B',
|
| 1017 |
+
'darkgoldenrod': '#B8860B',
|
| 1018 |
+
'darkgray': '#A9A9A9',
|
| 1019 |
+
'darkgreen': '#006400',
|
| 1020 |
+
'darkgrey': '#A9A9A9',
|
| 1021 |
+
'darkkhaki': '#BDB76B',
|
| 1022 |
+
'darkmagenta': '#8B008B',
|
| 1023 |
+
'darkolivegreen': '#556B2F',
|
| 1024 |
+
'darkorange': '#FF8C00',
|
| 1025 |
+
'darkorchid': '#9932CC',
|
| 1026 |
+
'darkred': '#8B0000',
|
| 1027 |
+
'darksalmon': '#E9967A',
|
| 1028 |
+
'darkseagreen': '#8FBC8F',
|
| 1029 |
+
'darkslateblue': '#483D8B',
|
| 1030 |
+
'darkslategray': '#2F4F4F',
|
| 1031 |
+
'darkslategrey': '#2F4F4F',
|
| 1032 |
+
'darkturquoise': '#00CED1',
|
| 1033 |
+
'darkviolet': '#9400D3',
|
| 1034 |
+
'deeppink': '#FF1493',
|
| 1035 |
+
'deepskyblue': '#00BFFF',
|
| 1036 |
+
'dimgray': '#696969',
|
| 1037 |
+
'dimgrey': '#696969',
|
| 1038 |
+
'dodgerblue': '#1E90FF',
|
| 1039 |
+
'firebrick': '#B22222',
|
| 1040 |
+
'floralwhite': '#FFFAF0',
|
| 1041 |
+
'forestgreen': '#228B22',
|
| 1042 |
+
'fuchsia': '#FF00FF',
|
| 1043 |
+
'gainsboro': '#DCDCDC',
|
| 1044 |
+
'ghostwhite': '#F8F8FF',
|
| 1045 |
+
'gold': '#FFD700',
|
| 1046 |
+
'goldenrod': '#DAA520',
|
| 1047 |
+
'gray': '#808080',
|
| 1048 |
+
'green': '#008000',
|
| 1049 |
+
'greenyellow': '#ADFF2F',
|
| 1050 |
+
'grey': '#808080',
|
| 1051 |
+
'honeydew': '#F0FFF0',
|
| 1052 |
+
'hotpink': '#FF69B4',
|
| 1053 |
+
'indianred': '#CD5C5C',
|
| 1054 |
+
'indigo': '#4B0082',
|
| 1055 |
+
'ivory': '#FFFFF0',
|
| 1056 |
+
'khaki': '#F0E68C',
|
| 1057 |
+
'lavender': '#E6E6FA',
|
| 1058 |
+
'lavenderblush': '#FFF0F5',
|
| 1059 |
+
'lawngreen': '#7CFC00',
|
| 1060 |
+
'lemonchiffon': '#FFFACD',
|
| 1061 |
+
'lightblue': '#ADD8E6',
|
| 1062 |
+
'lightcoral': '#F08080',
|
| 1063 |
+
'lightcyan': '#E0FFFF',
|
| 1064 |
+
'lightgoldenrodyellow': '#FAFAD2',
|
| 1065 |
+
'lightgray': '#D3D3D3',
|
| 1066 |
+
'lightgreen': '#90EE90',
|
| 1067 |
+
'lightgrey': '#D3D3D3',
|
| 1068 |
+
'lightpink': '#FFB6C1',
|
| 1069 |
+
'lightsalmon': '#FFA07A',
|
| 1070 |
+
'lightseagreen': '#20B2AA',
|
| 1071 |
+
'lightskyblue': '#87CEFA',
|
| 1072 |
+
'lightslategray': '#778899',
|
| 1073 |
+
'lightslategrey': '#778899',
|
| 1074 |
+
'lightsteelblue': '#B0C4DE',
|
| 1075 |
+
'lightyellow': '#FFFFE0',
|
| 1076 |
+
'lime': '#00FF00',
|
| 1077 |
+
'limegreen': '#32CD32',
|
| 1078 |
+
'linen': '#FAF0E6',
|
| 1079 |
+
'magenta': '#FF00FF',
|
| 1080 |
+
'maroon': '#800000',
|
| 1081 |
+
'mediumaquamarine': '#66CDAA',
|
| 1082 |
+
'mediumblue': '#0000CD',
|
| 1083 |
+
'mediumorchid': '#BA55D3',
|
| 1084 |
+
'mediumpurple': '#9370DB',
|
| 1085 |
+
'mediumseagreen': '#3CB371',
|
| 1086 |
+
'mediumslateblue': '#7B68EE',
|
| 1087 |
+
'mediumspringgreen': '#00FA9A',
|
| 1088 |
+
'mediumturquoise': '#48D1CC',
|
| 1089 |
+
'mediumvioletred': '#C71585',
|
| 1090 |
+
'midnightblue': '#191970',
|
| 1091 |
+
'mintcream': '#F5FFFA',
|
| 1092 |
+
'mistyrose': '#FFE4E1',
|
| 1093 |
+
'moccasin': '#FFE4B5',
|
| 1094 |
+
'navajowhite': '#FFDEAD',
|
| 1095 |
+
'navy': '#000080',
|
| 1096 |
+
'oldlace': '#FDF5E6',
|
| 1097 |
+
'olive': '#808000',
|
| 1098 |
+
'olivedrab': '#6B8E23',
|
| 1099 |
+
'orange': '#FFA500',
|
| 1100 |
+
'orangered': '#FF4500',
|
| 1101 |
+
'orchid': '#DA70D6',
|
| 1102 |
+
'palegoldenrod': '#EEE8AA',
|
| 1103 |
+
'palegreen': '#98FB98',
|
| 1104 |
+
'paleturquoise': '#AFEEEE',
|
| 1105 |
+
'palevioletred': '#DB7093',
|
| 1106 |
+
'papayawhip': '#FFEFD5',
|
| 1107 |
+
'peachpuff': '#FFDAB9',
|
| 1108 |
+
'peru': '#CD853F',
|
| 1109 |
+
'pink': '#FFC0CB',
|
| 1110 |
+
'plum': '#DDA0DD',
|
| 1111 |
+
'powderblue': '#B0E0E6',
|
| 1112 |
+
'purple': '#800080',
|
| 1113 |
+
'rebeccapurple': '#663399',
|
| 1114 |
+
'red': '#FF0000',
|
| 1115 |
+
'rosybrown': '#BC8F8F',
|
| 1116 |
+
'royalblue': '#4169E1',
|
| 1117 |
+
'saddlebrown': '#8B4513',
|
| 1118 |
+
'salmon': '#FA8072',
|
| 1119 |
+
'sandybrown': '#F4A460',
|
| 1120 |
+
'seagreen': '#2E8B57',
|
| 1121 |
+
'seashell': '#FFF5EE',
|
| 1122 |
+
'sienna': '#A0522D',
|
| 1123 |
+
'silver': '#C0C0C0',
|
| 1124 |
+
'skyblue': '#87CEEB',
|
| 1125 |
+
'slateblue': '#6A5ACD',
|
| 1126 |
+
'slategray': '#708090',
|
| 1127 |
+
'slategrey': '#708090',
|
| 1128 |
+
'snow': '#FFFAFA',
|
| 1129 |
+
'springgreen': '#00FF7F',
|
| 1130 |
+
'steelblue': '#4682B4',
|
| 1131 |
+
'tan': '#D2B48C',
|
| 1132 |
+
'teal': '#008080',
|
| 1133 |
+
'thistle': '#D8BFD8',
|
| 1134 |
+
'tomato': '#FF6347',
|
| 1135 |
+
'turquoise': '#40E0D0',
|
| 1136 |
+
'violet': '#EE82EE',
|
| 1137 |
+
'wheat': '#F5DEB3',
|
| 1138 |
+
'white': '#FFFFFF',
|
| 1139 |
+
'whitesmoke': '#F5F5F5',
|
| 1140 |
+
'yellow': '#FFFF00',
|
| 1141 |
+
'yellowgreen': '#9ACD32'}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_color_data.pyi
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .typing import ColorType
|
| 2 |
+
|
| 3 |
+
BASE_COLORS: dict[str, ColorType]
|
| 4 |
+
TABLEAU_COLORS: dict[str, ColorType]
|
| 5 |
+
XKCD_COLORS: dict[str, ColorType]
|
| 6 |
+
CSS4_COLORS: dict[str, ColorType]
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Adjust subplot layouts so that there are no overlapping Axes or Axes
|
| 3 |
+
decorations. All Axes decorations are dealt with (labels, ticks, titles,
|
| 4 |
+
ticklabels) and some dependent artists are also dealt with (colorbar,
|
| 5 |
+
suptitle).
|
| 6 |
+
|
| 7 |
+
Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
|
| 8 |
+
so it is possible to have overlapping Axes if the gridspecs overlap (i.e.
|
| 9 |
+
using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using
|
| 10 |
+
``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
|
| 11 |
+
layout. Axes manually placed via ``figure.add_axes()`` will not.
|
| 12 |
+
|
| 13 |
+
See Tutorial: :ref:`constrainedlayout_guide`
|
| 14 |
+
|
| 15 |
+
General idea:
|
| 16 |
+
-------------
|
| 17 |
+
|
| 18 |
+
First, a figure has a gridspec that divides the figure into nrows and ncols,
|
| 19 |
+
with heights and widths set by ``height_ratios`` and ``width_ratios``,
|
| 20 |
+
often just set to 1 for an equal grid.
|
| 21 |
+
|
| 22 |
+
Subplotspecs that are derived from this gridspec can contain either a
|
| 23 |
+
``SubPanel``, a ``GridSpecFromSubplotSpec``, or an ``Axes``. The ``SubPanel``
|
| 24 |
+
and ``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
|
| 25 |
+
analogous layout.
|
| 26 |
+
|
| 27 |
+
Each ``GridSpec`` has a ``_layoutgrid`` attached to it. The ``_layoutgrid``
|
| 28 |
+
has the same logical layout as the ``GridSpec``. Each row of the grid spec
|
| 29 |
+
has a top and bottom "margin" and each column has a left and right "margin".
|
| 30 |
+
The "inner" height of each row is constrained to be the same (or as modified
|
| 31 |
+
by ``height_ratio``), and the "inner" width of each column is
|
| 32 |
+
constrained to be the same (as modified by ``width_ratio``), where "inner"
|
| 33 |
+
is the width or height of each column/row minus the size of the margins.
|
| 34 |
+
|
| 35 |
+
Then the size of the margins for each row and column are determined as the
|
| 36 |
+
max width of the decorators on each Axes that has decorators in that margin.
|
| 37 |
+
For instance, a normal Axes would have a left margin that includes the
|
| 38 |
+
left ticklabels, and the ylabel if it exists. The right margin may include a
|
| 39 |
+
colorbar, the bottom margin the xaxis decorations, and the top margin the
|
| 40 |
+
title.
|
| 41 |
+
|
| 42 |
+
With these constraints, the solver then finds appropriate bounds for the
|
| 43 |
+
columns and rows. It's possible that the margins take up the whole figure,
|
| 44 |
+
in which case the algorithm is not applied and a warning is raised.
|
| 45 |
+
|
| 46 |
+
See the tutorial :ref:`constrainedlayout_guide`
|
| 47 |
+
for more discussion of the algorithm with examples.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
import logging
|
| 51 |
+
|
| 52 |
+
import numpy as np
|
| 53 |
+
|
| 54 |
+
from matplotlib import _api, artist as martist
|
| 55 |
+
import matplotlib.transforms as mtransforms
|
| 56 |
+
import matplotlib._layoutgrid as mlayoutgrid
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
_log = logging.getLogger(__name__)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
######################################################
|
| 63 |
+
def do_constrained_layout(fig, h_pad, w_pad,
|
| 64 |
+
hspace=None, wspace=None, rect=(0, 0, 1, 1),
|
| 65 |
+
compress=False):
|
| 66 |
+
"""
|
| 67 |
+
Do the constrained_layout. Called at draw time in
|
| 68 |
+
``figure.constrained_layout()``
|
| 69 |
+
|
| 70 |
+
Parameters
|
| 71 |
+
----------
|
| 72 |
+
fig : `~matplotlib.figure.Figure`
|
| 73 |
+
`.Figure` instance to do the layout in.
|
| 74 |
+
|
| 75 |
+
h_pad, w_pad : float
|
| 76 |
+
Padding around the Axes elements in figure-normalized units.
|
| 77 |
+
|
| 78 |
+
hspace, wspace : float
|
| 79 |
+
Fraction of the figure to dedicate to space between the
|
| 80 |
+
Axes. These are evenly spread between the gaps between the Axes.
|
| 81 |
+
A value of 0.2 for a three-column layout would have a space
|
| 82 |
+
of 0.1 of the figure width between each column.
|
| 83 |
+
If h/wspace < h/w_pad, then the pads are used instead.
|
| 84 |
+
|
| 85 |
+
rect : tuple of 4 floats
|
| 86 |
+
Rectangle in figure coordinates to perform constrained layout in
|
| 87 |
+
[left, bottom, width, height], each from 0-1.
|
| 88 |
+
|
| 89 |
+
compress : bool
|
| 90 |
+
Whether to shift Axes so that white space in between them is
|
| 91 |
+
removed. This is useful for simple grids of fixed-aspect Axes (e.g.
|
| 92 |
+
a grid of images).
|
| 93 |
+
|
| 94 |
+
Returns
|
| 95 |
+
-------
|
| 96 |
+
layoutgrid : private debugging structure
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
renderer = fig._get_renderer()
|
| 100 |
+
# make layoutgrid tree...
|
| 101 |
+
layoutgrids = make_layoutgrids(fig, None, rect=rect)
|
| 102 |
+
if not layoutgrids['hasgrids']:
|
| 103 |
+
_api.warn_external('There are no gridspecs with layoutgrids. '
|
| 104 |
+
'Possibly did not call parent GridSpec with the'
|
| 105 |
+
' "figure" keyword')
|
| 106 |
+
return
|
| 107 |
+
|
| 108 |
+
for _ in range(2):
|
| 109 |
+
# do the algorithm twice. This has to be done because decorations
|
| 110 |
+
# change size after the first re-position (i.e. x/yticklabels get
|
| 111 |
+
# larger/smaller). This second reposition tends to be much milder,
|
| 112 |
+
# so doing twice makes things work OK.
|
| 113 |
+
|
| 114 |
+
# make margins for all the Axes and subfigures in the
|
| 115 |
+
# figure. Add margins for colorbars...
|
| 116 |
+
make_layout_margins(layoutgrids, fig, renderer, h_pad=h_pad,
|
| 117 |
+
w_pad=w_pad, hspace=hspace, wspace=wspace)
|
| 118 |
+
make_margin_suptitles(layoutgrids, fig, renderer, h_pad=h_pad,
|
| 119 |
+
w_pad=w_pad)
|
| 120 |
+
|
| 121 |
+
# if a layout is such that a columns (or rows) margin has no
|
| 122 |
+
# constraints, we need to make all such instances in the grid
|
| 123 |
+
# match in margin size.
|
| 124 |
+
match_submerged_margins(layoutgrids, fig)
|
| 125 |
+
|
| 126 |
+
# update all the variables in the layout.
|
| 127 |
+
layoutgrids[fig].update_variables()
|
| 128 |
+
|
| 129 |
+
warn_collapsed = ('constrained_layout not applied because '
|
| 130 |
+
'axes sizes collapsed to zero. Try making '
|
| 131 |
+
'figure larger or Axes decorations smaller.')
|
| 132 |
+
if check_no_collapsed_axes(layoutgrids, fig):
|
| 133 |
+
reposition_axes(layoutgrids, fig, renderer, h_pad=h_pad,
|
| 134 |
+
w_pad=w_pad, hspace=hspace, wspace=wspace)
|
| 135 |
+
if compress:
|
| 136 |
+
layoutgrids = compress_fixed_aspect(layoutgrids, fig)
|
| 137 |
+
layoutgrids[fig].update_variables()
|
| 138 |
+
if check_no_collapsed_axes(layoutgrids, fig):
|
| 139 |
+
reposition_axes(layoutgrids, fig, renderer, h_pad=h_pad,
|
| 140 |
+
w_pad=w_pad, hspace=hspace, wspace=wspace)
|
| 141 |
+
else:
|
| 142 |
+
_api.warn_external(warn_collapsed)
|
| 143 |
+
|
| 144 |
+
if ((suptitle := fig._suptitle) is not None and
|
| 145 |
+
suptitle.get_in_layout() and suptitle._autopos):
|
| 146 |
+
x, _ = suptitle.get_position()
|
| 147 |
+
suptitle.set_position(
|
| 148 |
+
(x, layoutgrids[fig].get_inner_bbox().y1 + h_pad))
|
| 149 |
+
suptitle.set_verticalalignment('bottom')
|
| 150 |
+
else:
|
| 151 |
+
_api.warn_external(warn_collapsed)
|
| 152 |
+
reset_margins(layoutgrids, fig)
|
| 153 |
+
return layoutgrids
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)):
|
| 157 |
+
"""
|
| 158 |
+
Make the layoutgrid tree.
|
| 159 |
+
|
| 160 |
+
(Sub)Figures get a layoutgrid so we can have figure margins.
|
| 161 |
+
|
| 162 |
+
Gridspecs that are attached to Axes get a layoutgrid so Axes
|
| 163 |
+
can have margins.
|
| 164 |
+
"""
|
| 165 |
+
|
| 166 |
+
if layoutgrids is None:
|
| 167 |
+
layoutgrids = dict()
|
| 168 |
+
layoutgrids['hasgrids'] = False
|
| 169 |
+
if not hasattr(fig, '_parent'):
|
| 170 |
+
# top figure; pass rect as parent to allow user-specified
|
| 171 |
+
# margins
|
| 172 |
+
layoutgrids[fig] = mlayoutgrid.LayoutGrid(parent=rect, name='figlb')
|
| 173 |
+
else:
|
| 174 |
+
# subfigure
|
| 175 |
+
gs = fig._subplotspec.get_gridspec()
|
| 176 |
+
# it is possible the gridspec containing this subfigure hasn't
|
| 177 |
+
# been added to the tree yet:
|
| 178 |
+
layoutgrids = make_layoutgrids_gs(layoutgrids, gs)
|
| 179 |
+
# add the layoutgrid for the subfigure:
|
| 180 |
+
parentlb = layoutgrids[gs]
|
| 181 |
+
layoutgrids[fig] = mlayoutgrid.LayoutGrid(
|
| 182 |
+
parent=parentlb,
|
| 183 |
+
name='panellb',
|
| 184 |
+
parent_inner=True,
|
| 185 |
+
nrows=1, ncols=1,
|
| 186 |
+
parent_pos=(fig._subplotspec.rowspan,
|
| 187 |
+
fig._subplotspec.colspan))
|
| 188 |
+
# recursively do all subfigures in this figure...
|
| 189 |
+
for sfig in fig.subfigs:
|
| 190 |
+
layoutgrids = make_layoutgrids(sfig, layoutgrids)
|
| 191 |
+
|
| 192 |
+
# for each Axes at the local level add its gridspec:
|
| 193 |
+
for ax in fig._localaxes:
|
| 194 |
+
gs = ax.get_gridspec()
|
| 195 |
+
if gs is not None:
|
| 196 |
+
layoutgrids = make_layoutgrids_gs(layoutgrids, gs)
|
| 197 |
+
|
| 198 |
+
return layoutgrids
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def make_layoutgrids_gs(layoutgrids, gs):
|
| 202 |
+
"""
|
| 203 |
+
Make the layoutgrid for a gridspec (and anything nested in the gridspec)
|
| 204 |
+
"""
|
| 205 |
+
|
| 206 |
+
if gs in layoutgrids or gs.figure is None:
|
| 207 |
+
return layoutgrids
|
| 208 |
+
# in order to do constrained_layout there has to be at least *one*
|
| 209 |
+
# gridspec in the tree:
|
| 210 |
+
layoutgrids['hasgrids'] = True
|
| 211 |
+
if not hasattr(gs, '_subplot_spec'):
|
| 212 |
+
# normal gridspec
|
| 213 |
+
parent = layoutgrids[gs.figure]
|
| 214 |
+
layoutgrids[gs] = mlayoutgrid.LayoutGrid(
|
| 215 |
+
parent=parent,
|
| 216 |
+
parent_inner=True,
|
| 217 |
+
name='gridspec',
|
| 218 |
+
ncols=gs._ncols, nrows=gs._nrows,
|
| 219 |
+
width_ratios=gs.get_width_ratios(),
|
| 220 |
+
height_ratios=gs.get_height_ratios())
|
| 221 |
+
else:
|
| 222 |
+
# this is a gridspecfromsubplotspec:
|
| 223 |
+
subplot_spec = gs._subplot_spec
|
| 224 |
+
parentgs = subplot_spec.get_gridspec()
|
| 225 |
+
# if a nested gridspec it is possible the parent is not in there yet:
|
| 226 |
+
if parentgs not in layoutgrids:
|
| 227 |
+
layoutgrids = make_layoutgrids_gs(layoutgrids, parentgs)
|
| 228 |
+
subspeclb = layoutgrids[parentgs]
|
| 229 |
+
# gridspecfromsubplotspec need an outer container:
|
| 230 |
+
# get a unique representation:
|
| 231 |
+
rep = (gs, 'top')
|
| 232 |
+
if rep not in layoutgrids:
|
| 233 |
+
layoutgrids[rep] = mlayoutgrid.LayoutGrid(
|
| 234 |
+
parent=subspeclb,
|
| 235 |
+
name='top',
|
| 236 |
+
nrows=1, ncols=1,
|
| 237 |
+
parent_pos=(subplot_spec.rowspan, subplot_spec.colspan))
|
| 238 |
+
layoutgrids[gs] = mlayoutgrid.LayoutGrid(
|
| 239 |
+
parent=layoutgrids[rep],
|
| 240 |
+
name='gridspec',
|
| 241 |
+
nrows=gs._nrows, ncols=gs._ncols,
|
| 242 |
+
width_ratios=gs.get_width_ratios(),
|
| 243 |
+
height_ratios=gs.get_height_ratios())
|
| 244 |
+
return layoutgrids
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
def check_no_collapsed_axes(layoutgrids, fig):
|
| 248 |
+
"""
|
| 249 |
+
Check that no Axes have collapsed to zero size.
|
| 250 |
+
"""
|
| 251 |
+
for sfig in fig.subfigs:
|
| 252 |
+
ok = check_no_collapsed_axes(layoutgrids, sfig)
|
| 253 |
+
if not ok:
|
| 254 |
+
return False
|
| 255 |
+
for ax in fig.axes:
|
| 256 |
+
gs = ax.get_gridspec()
|
| 257 |
+
if gs in layoutgrids: # also implies gs is not None.
|
| 258 |
+
lg = layoutgrids[gs]
|
| 259 |
+
for i in range(gs.nrows):
|
| 260 |
+
for j in range(gs.ncols):
|
| 261 |
+
bb = lg.get_inner_bbox(i, j)
|
| 262 |
+
if bb.width <= 0 or bb.height <= 0:
|
| 263 |
+
return False
|
| 264 |
+
return True
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def compress_fixed_aspect(layoutgrids, fig):
|
| 268 |
+
gs = None
|
| 269 |
+
for ax in fig.axes:
|
| 270 |
+
if ax.get_subplotspec() is None:
|
| 271 |
+
continue
|
| 272 |
+
ax.apply_aspect()
|
| 273 |
+
sub = ax.get_subplotspec()
|
| 274 |
+
_gs = sub.get_gridspec()
|
| 275 |
+
if gs is None:
|
| 276 |
+
gs = _gs
|
| 277 |
+
extraw = np.zeros(gs.ncols)
|
| 278 |
+
extrah = np.zeros(gs.nrows)
|
| 279 |
+
elif _gs != gs:
|
| 280 |
+
raise ValueError('Cannot do compressed layout if Axes are not'
|
| 281 |
+
'all from the same gridspec')
|
| 282 |
+
orig = ax.get_position(original=True)
|
| 283 |
+
actual = ax.get_position(original=False)
|
| 284 |
+
dw = orig.width - actual.width
|
| 285 |
+
if dw > 0:
|
| 286 |
+
extraw[sub.colspan] = np.maximum(extraw[sub.colspan], dw)
|
| 287 |
+
dh = orig.height - actual.height
|
| 288 |
+
if dh > 0:
|
| 289 |
+
extrah[sub.rowspan] = np.maximum(extrah[sub.rowspan], dh)
|
| 290 |
+
|
| 291 |
+
if gs is None:
|
| 292 |
+
raise ValueError('Cannot do compressed layout if no Axes '
|
| 293 |
+
'are part of a gridspec.')
|
| 294 |
+
w = np.sum(extraw) / 2
|
| 295 |
+
layoutgrids[fig].edit_margin_min('left', w)
|
| 296 |
+
layoutgrids[fig].edit_margin_min('right', w)
|
| 297 |
+
|
| 298 |
+
h = np.sum(extrah) / 2
|
| 299 |
+
layoutgrids[fig].edit_margin_min('top', h)
|
| 300 |
+
layoutgrids[fig].edit_margin_min('bottom', h)
|
| 301 |
+
return layoutgrids
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
def get_margin_from_padding(obj, *, w_pad=0, h_pad=0,
|
| 305 |
+
hspace=0, wspace=0):
|
| 306 |
+
|
| 307 |
+
ss = obj._subplotspec
|
| 308 |
+
gs = ss.get_gridspec()
|
| 309 |
+
|
| 310 |
+
if hasattr(gs, 'hspace'):
|
| 311 |
+
_hspace = (gs.hspace if gs.hspace is not None else hspace)
|
| 312 |
+
_wspace = (gs.wspace if gs.wspace is not None else wspace)
|
| 313 |
+
else:
|
| 314 |
+
_hspace = (gs._hspace if gs._hspace is not None else hspace)
|
| 315 |
+
_wspace = (gs._wspace if gs._wspace is not None else wspace)
|
| 316 |
+
|
| 317 |
+
_wspace = _wspace / 2
|
| 318 |
+
_hspace = _hspace / 2
|
| 319 |
+
|
| 320 |
+
nrows, ncols = gs.get_geometry()
|
| 321 |
+
# there are two margins for each direction. The "cb"
|
| 322 |
+
# margins are for pads and colorbars, the non-"cb" are
|
| 323 |
+
# for the Axes decorations (labels etc).
|
| 324 |
+
margin = {'leftcb': w_pad, 'rightcb': w_pad,
|
| 325 |
+
'bottomcb': h_pad, 'topcb': h_pad,
|
| 326 |
+
'left': 0, 'right': 0,
|
| 327 |
+
'top': 0, 'bottom': 0}
|
| 328 |
+
if _wspace / ncols > w_pad:
|
| 329 |
+
if ss.colspan.start > 0:
|
| 330 |
+
margin['leftcb'] = _wspace / ncols
|
| 331 |
+
if ss.colspan.stop < ncols:
|
| 332 |
+
margin['rightcb'] = _wspace / ncols
|
| 333 |
+
if _hspace / nrows > h_pad:
|
| 334 |
+
if ss.rowspan.stop < nrows:
|
| 335 |
+
margin['bottomcb'] = _hspace / nrows
|
| 336 |
+
if ss.rowspan.start > 0:
|
| 337 |
+
margin['topcb'] = _hspace / nrows
|
| 338 |
+
|
| 339 |
+
return margin
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0,
|
| 343 |
+
hspace=0, wspace=0):
|
| 344 |
+
"""
|
| 345 |
+
For each Axes, make a margin between the *pos* layoutbox and the
|
| 346 |
+
*axes* layoutbox be a minimum size that can accommodate the
|
| 347 |
+
decorations on the axis.
|
| 348 |
+
|
| 349 |
+
Then make room for colorbars.
|
| 350 |
+
|
| 351 |
+
Parameters
|
| 352 |
+
----------
|
| 353 |
+
layoutgrids : dict
|
| 354 |
+
fig : `~matplotlib.figure.Figure`
|
| 355 |
+
`.Figure` instance to do the layout in.
|
| 356 |
+
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
|
| 357 |
+
The renderer to use.
|
| 358 |
+
w_pad, h_pad : float, default: 0
|
| 359 |
+
Width and height padding (in fraction of figure).
|
| 360 |
+
hspace, wspace : float, default: 0
|
| 361 |
+
Width and height padding as fraction of figure size divided by
|
| 362 |
+
number of columns or rows.
|
| 363 |
+
"""
|
| 364 |
+
for sfig in fig.subfigs: # recursively make child panel margins
|
| 365 |
+
ss = sfig._subplotspec
|
| 366 |
+
gs = ss.get_gridspec()
|
| 367 |
+
|
| 368 |
+
make_layout_margins(layoutgrids, sfig, renderer,
|
| 369 |
+
w_pad=w_pad, h_pad=h_pad,
|
| 370 |
+
hspace=hspace, wspace=wspace)
|
| 371 |
+
|
| 372 |
+
margins = get_margin_from_padding(sfig, w_pad=0, h_pad=0,
|
| 373 |
+
hspace=hspace, wspace=wspace)
|
| 374 |
+
layoutgrids[gs].edit_outer_margin_mins(margins, ss)
|
| 375 |
+
|
| 376 |
+
for ax in fig._localaxes:
|
| 377 |
+
if not ax.get_subplotspec() or not ax.get_in_layout():
|
| 378 |
+
continue
|
| 379 |
+
|
| 380 |
+
ss = ax.get_subplotspec()
|
| 381 |
+
gs = ss.get_gridspec()
|
| 382 |
+
|
| 383 |
+
if gs not in layoutgrids:
|
| 384 |
+
return
|
| 385 |
+
|
| 386 |
+
margin = get_margin_from_padding(ax, w_pad=w_pad, h_pad=h_pad,
|
| 387 |
+
hspace=hspace, wspace=wspace)
|
| 388 |
+
pos, bbox = get_pos_and_bbox(ax, renderer)
|
| 389 |
+
# the margin is the distance between the bounding box of the Axes
|
| 390 |
+
# and its position (plus the padding from above)
|
| 391 |
+
margin['left'] += pos.x0 - bbox.x0
|
| 392 |
+
margin['right'] += bbox.x1 - pos.x1
|
| 393 |
+
# remember that rows are ordered from top:
|
| 394 |
+
margin['bottom'] += pos.y0 - bbox.y0
|
| 395 |
+
margin['top'] += bbox.y1 - pos.y1
|
| 396 |
+
|
| 397 |
+
# make margin for colorbars. These margins go in the
|
| 398 |
+
# padding margin, versus the margin for Axes decorators.
|
| 399 |
+
for cbax in ax._colorbars:
|
| 400 |
+
# note pad is a fraction of the parent width...
|
| 401 |
+
pad = colorbar_get_pad(layoutgrids, cbax)
|
| 402 |
+
# colorbars can be child of more than one subplot spec:
|
| 403 |
+
cbp_rspan, cbp_cspan = get_cb_parent_spans(cbax)
|
| 404 |
+
loc = cbax._colorbar_info['location']
|
| 405 |
+
cbpos, cbbbox = get_pos_and_bbox(cbax, renderer)
|
| 406 |
+
if loc == 'right':
|
| 407 |
+
if cbp_cspan.stop == ss.colspan.stop:
|
| 408 |
+
# only increase if the colorbar is on the right edge
|
| 409 |
+
margin['rightcb'] += cbbbox.width + pad
|
| 410 |
+
elif loc == 'left':
|
| 411 |
+
if cbp_cspan.start == ss.colspan.start:
|
| 412 |
+
# only increase if the colorbar is on the left edge
|
| 413 |
+
margin['leftcb'] += cbbbox.width + pad
|
| 414 |
+
elif loc == 'top':
|
| 415 |
+
if cbp_rspan.start == ss.rowspan.start:
|
| 416 |
+
margin['topcb'] += cbbbox.height + pad
|
| 417 |
+
else:
|
| 418 |
+
if cbp_rspan.stop == ss.rowspan.stop:
|
| 419 |
+
margin['bottomcb'] += cbbbox.height + pad
|
| 420 |
+
# If the colorbars are wider than the parent box in the
|
| 421 |
+
# cross direction
|
| 422 |
+
if loc in ['top', 'bottom']:
|
| 423 |
+
if (cbp_cspan.start == ss.colspan.start and
|
| 424 |
+
cbbbox.x0 < bbox.x0):
|
| 425 |
+
margin['left'] += bbox.x0 - cbbbox.x0
|
| 426 |
+
if (cbp_cspan.stop == ss.colspan.stop and
|
| 427 |
+
cbbbox.x1 > bbox.x1):
|
| 428 |
+
margin['right'] += cbbbox.x1 - bbox.x1
|
| 429 |
+
# or taller:
|
| 430 |
+
if loc in ['left', 'right']:
|
| 431 |
+
if (cbp_rspan.stop == ss.rowspan.stop and
|
| 432 |
+
cbbbox.y0 < bbox.y0):
|
| 433 |
+
margin['bottom'] += bbox.y0 - cbbbox.y0
|
| 434 |
+
if (cbp_rspan.start == ss.rowspan.start and
|
| 435 |
+
cbbbox.y1 > bbox.y1):
|
| 436 |
+
margin['top'] += cbbbox.y1 - bbox.y1
|
| 437 |
+
# pass the new margins down to the layout grid for the solution...
|
| 438 |
+
layoutgrids[gs].edit_outer_margin_mins(margin, ss)
|
| 439 |
+
|
| 440 |
+
# make margins for figure-level legends:
|
| 441 |
+
for leg in fig.legends:
|
| 442 |
+
inv_trans_fig = None
|
| 443 |
+
if leg._outside_loc and leg._bbox_to_anchor is None:
|
| 444 |
+
if inv_trans_fig is None:
|
| 445 |
+
inv_trans_fig = fig.transFigure.inverted().transform_bbox
|
| 446 |
+
bbox = inv_trans_fig(leg.get_tightbbox(renderer))
|
| 447 |
+
w = bbox.width + 2 * w_pad
|
| 448 |
+
h = bbox.height + 2 * h_pad
|
| 449 |
+
legendloc = leg._outside_loc
|
| 450 |
+
if legendloc == 'lower':
|
| 451 |
+
layoutgrids[fig].edit_margin_min('bottom', h)
|
| 452 |
+
elif legendloc == 'upper':
|
| 453 |
+
layoutgrids[fig].edit_margin_min('top', h)
|
| 454 |
+
if legendloc == 'right':
|
| 455 |
+
layoutgrids[fig].edit_margin_min('right', w)
|
| 456 |
+
elif legendloc == 'left':
|
| 457 |
+
layoutgrids[fig].edit_margin_min('left', w)
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
def make_margin_suptitles(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0):
|
| 461 |
+
# Figure out how large the suptitle is and make the
|
| 462 |
+
# top level figure margin larger.
|
| 463 |
+
|
| 464 |
+
inv_trans_fig = fig.transFigure.inverted().transform_bbox
|
| 465 |
+
# get the h_pad and w_pad as distances in the local subfigure coordinates:
|
| 466 |
+
padbox = mtransforms.Bbox([[0, 0], [w_pad, h_pad]])
|
| 467 |
+
padbox = (fig.transFigure -
|
| 468 |
+
fig.transSubfigure).transform_bbox(padbox)
|
| 469 |
+
h_pad_local = padbox.height
|
| 470 |
+
w_pad_local = padbox.width
|
| 471 |
+
|
| 472 |
+
for sfig in fig.subfigs:
|
| 473 |
+
make_margin_suptitles(layoutgrids, sfig, renderer,
|
| 474 |
+
w_pad=w_pad, h_pad=h_pad)
|
| 475 |
+
|
| 476 |
+
if fig._suptitle is not None and fig._suptitle.get_in_layout():
|
| 477 |
+
p = fig._suptitle.get_position()
|
| 478 |
+
if getattr(fig._suptitle, '_autopos', False):
|
| 479 |
+
fig._suptitle.set_position((p[0], 1 - h_pad_local))
|
| 480 |
+
bbox = inv_trans_fig(fig._suptitle.get_tightbbox(renderer))
|
| 481 |
+
layoutgrids[fig].edit_margin_min('top', bbox.height + 2 * h_pad)
|
| 482 |
+
|
| 483 |
+
if fig._supxlabel is not None and fig._supxlabel.get_in_layout():
|
| 484 |
+
p = fig._supxlabel.get_position()
|
| 485 |
+
if getattr(fig._supxlabel, '_autopos', False):
|
| 486 |
+
fig._supxlabel.set_position((p[0], h_pad_local))
|
| 487 |
+
bbox = inv_trans_fig(fig._supxlabel.get_tightbbox(renderer))
|
| 488 |
+
layoutgrids[fig].edit_margin_min('bottom',
|
| 489 |
+
bbox.height + 2 * h_pad)
|
| 490 |
+
|
| 491 |
+
if fig._supylabel is not None and fig._supylabel.get_in_layout():
|
| 492 |
+
p = fig._supylabel.get_position()
|
| 493 |
+
if getattr(fig._supylabel, '_autopos', False):
|
| 494 |
+
fig._supylabel.set_position((w_pad_local, p[1]))
|
| 495 |
+
bbox = inv_trans_fig(fig._supylabel.get_tightbbox(renderer))
|
| 496 |
+
layoutgrids[fig].edit_margin_min('left', bbox.width + 2 * w_pad)
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
def match_submerged_margins(layoutgrids, fig):
|
| 500 |
+
"""
|
| 501 |
+
Make the margins that are submerged inside an Axes the same size.
|
| 502 |
+
|
| 503 |
+
This allows Axes that span two columns (or rows) that are offset
|
| 504 |
+
from one another to have the same size.
|
| 505 |
+
|
| 506 |
+
This gives the proper layout for something like::
|
| 507 |
+
fig = plt.figure(constrained_layout=True)
|
| 508 |
+
axs = fig.subplot_mosaic("AAAB\nCCDD")
|
| 509 |
+
|
| 510 |
+
Without this routine, the Axes D will be wider than C, because the
|
| 511 |
+
margin width between the two columns in C has no width by default,
|
| 512 |
+
whereas the margins between the two columns of D are set by the
|
| 513 |
+
width of the margin between A and B. However, obviously the user would
|
| 514 |
+
like C and D to be the same size, so we need to add constraints to these
|
| 515 |
+
"submerged" margins.
|
| 516 |
+
|
| 517 |
+
This routine makes all the interior margins the same, and the spacing
|
| 518 |
+
between the three columns in A and the two column in C are all set to the
|
| 519 |
+
margins between the two columns of D.
|
| 520 |
+
|
| 521 |
+
See test_constrained_layout::test_constrained_layout12 for an example.
|
| 522 |
+
"""
|
| 523 |
+
|
| 524 |
+
axsdone = []
|
| 525 |
+
for sfig in fig.subfigs:
|
| 526 |
+
axsdone += match_submerged_margins(layoutgrids, sfig)
|
| 527 |
+
|
| 528 |
+
axs = [a for a in fig.get_axes()
|
| 529 |
+
if (a.get_subplotspec() is not None and a.get_in_layout() and
|
| 530 |
+
a not in axsdone)]
|
| 531 |
+
|
| 532 |
+
for ax1 in axs:
|
| 533 |
+
ss1 = ax1.get_subplotspec()
|
| 534 |
+
if ss1.get_gridspec() not in layoutgrids:
|
| 535 |
+
axs.remove(ax1)
|
| 536 |
+
continue
|
| 537 |
+
lg1 = layoutgrids[ss1.get_gridspec()]
|
| 538 |
+
|
| 539 |
+
# interior columns:
|
| 540 |
+
if len(ss1.colspan) > 1:
|
| 541 |
+
maxsubl = np.max(
|
| 542 |
+
lg1.margin_vals['left'][ss1.colspan[1:]] +
|
| 543 |
+
lg1.margin_vals['leftcb'][ss1.colspan[1:]]
|
| 544 |
+
)
|
| 545 |
+
maxsubr = np.max(
|
| 546 |
+
lg1.margin_vals['right'][ss1.colspan[:-1]] +
|
| 547 |
+
lg1.margin_vals['rightcb'][ss1.colspan[:-1]]
|
| 548 |
+
)
|
| 549 |
+
for ax2 in axs:
|
| 550 |
+
ss2 = ax2.get_subplotspec()
|
| 551 |
+
lg2 = layoutgrids[ss2.get_gridspec()]
|
| 552 |
+
if lg2 is not None and len(ss2.colspan) > 1:
|
| 553 |
+
maxsubl2 = np.max(
|
| 554 |
+
lg2.margin_vals['left'][ss2.colspan[1:]] +
|
| 555 |
+
lg2.margin_vals['leftcb'][ss2.colspan[1:]])
|
| 556 |
+
if maxsubl2 > maxsubl:
|
| 557 |
+
maxsubl = maxsubl2
|
| 558 |
+
maxsubr2 = np.max(
|
| 559 |
+
lg2.margin_vals['right'][ss2.colspan[:-1]] +
|
| 560 |
+
lg2.margin_vals['rightcb'][ss2.colspan[:-1]])
|
| 561 |
+
if maxsubr2 > maxsubr:
|
| 562 |
+
maxsubr = maxsubr2
|
| 563 |
+
for i in ss1.colspan[1:]:
|
| 564 |
+
lg1.edit_margin_min('left', maxsubl, cell=i)
|
| 565 |
+
for i in ss1.colspan[:-1]:
|
| 566 |
+
lg1.edit_margin_min('right', maxsubr, cell=i)
|
| 567 |
+
|
| 568 |
+
# interior rows:
|
| 569 |
+
if len(ss1.rowspan) > 1:
|
| 570 |
+
maxsubt = np.max(
|
| 571 |
+
lg1.margin_vals['top'][ss1.rowspan[1:]] +
|
| 572 |
+
lg1.margin_vals['topcb'][ss1.rowspan[1:]]
|
| 573 |
+
)
|
| 574 |
+
maxsubb = np.max(
|
| 575 |
+
lg1.margin_vals['bottom'][ss1.rowspan[:-1]] +
|
| 576 |
+
lg1.margin_vals['bottomcb'][ss1.rowspan[:-1]]
|
| 577 |
+
)
|
| 578 |
+
|
| 579 |
+
for ax2 in axs:
|
| 580 |
+
ss2 = ax2.get_subplotspec()
|
| 581 |
+
lg2 = layoutgrids[ss2.get_gridspec()]
|
| 582 |
+
if lg2 is not None:
|
| 583 |
+
if len(ss2.rowspan) > 1:
|
| 584 |
+
maxsubt = np.max([np.max(
|
| 585 |
+
lg2.margin_vals['top'][ss2.rowspan[1:]] +
|
| 586 |
+
lg2.margin_vals['topcb'][ss2.rowspan[1:]]
|
| 587 |
+
), maxsubt])
|
| 588 |
+
maxsubb = np.max([np.max(
|
| 589 |
+
lg2.margin_vals['bottom'][ss2.rowspan[:-1]] +
|
| 590 |
+
lg2.margin_vals['bottomcb'][ss2.rowspan[:-1]]
|
| 591 |
+
), maxsubb])
|
| 592 |
+
for i in ss1.rowspan[1:]:
|
| 593 |
+
lg1.edit_margin_min('top', maxsubt, cell=i)
|
| 594 |
+
for i in ss1.rowspan[:-1]:
|
| 595 |
+
lg1.edit_margin_min('bottom', maxsubb, cell=i)
|
| 596 |
+
|
| 597 |
+
return axs
|
| 598 |
+
|
| 599 |
+
|
| 600 |
+
def get_cb_parent_spans(cbax):
|
| 601 |
+
"""
|
| 602 |
+
Figure out which subplotspecs this colorbar belongs to.
|
| 603 |
+
|
| 604 |
+
Parameters
|
| 605 |
+
----------
|
| 606 |
+
cbax : `~matplotlib.axes.Axes`
|
| 607 |
+
Axes for the colorbar.
|
| 608 |
+
"""
|
| 609 |
+
rowstart = np.inf
|
| 610 |
+
rowstop = -np.inf
|
| 611 |
+
colstart = np.inf
|
| 612 |
+
colstop = -np.inf
|
| 613 |
+
for parent in cbax._colorbar_info['parents']:
|
| 614 |
+
ss = parent.get_subplotspec()
|
| 615 |
+
rowstart = min(ss.rowspan.start, rowstart)
|
| 616 |
+
rowstop = max(ss.rowspan.stop, rowstop)
|
| 617 |
+
colstart = min(ss.colspan.start, colstart)
|
| 618 |
+
colstop = max(ss.colspan.stop, colstop)
|
| 619 |
+
|
| 620 |
+
rowspan = range(rowstart, rowstop)
|
| 621 |
+
colspan = range(colstart, colstop)
|
| 622 |
+
return rowspan, colspan
|
| 623 |
+
|
| 624 |
+
|
| 625 |
+
def get_pos_and_bbox(ax, renderer):
|
| 626 |
+
"""
|
| 627 |
+
Get the position and the bbox for the Axes.
|
| 628 |
+
|
| 629 |
+
Parameters
|
| 630 |
+
----------
|
| 631 |
+
ax : `~matplotlib.axes.Axes`
|
| 632 |
+
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
|
| 633 |
+
|
| 634 |
+
Returns
|
| 635 |
+
-------
|
| 636 |
+
pos : `~matplotlib.transforms.Bbox`
|
| 637 |
+
Position in figure coordinates.
|
| 638 |
+
bbox : `~matplotlib.transforms.Bbox`
|
| 639 |
+
Tight bounding box in figure coordinates.
|
| 640 |
+
"""
|
| 641 |
+
fig = ax.get_figure(root=False)
|
| 642 |
+
pos = ax.get_position(original=True)
|
| 643 |
+
# pos is in panel co-ords, but we need in figure for the layout
|
| 644 |
+
pos = pos.transformed(fig.transSubfigure - fig.transFigure)
|
| 645 |
+
tightbbox = martist._get_tightbbox_for_layout_only(ax, renderer)
|
| 646 |
+
if tightbbox is None:
|
| 647 |
+
bbox = pos
|
| 648 |
+
else:
|
| 649 |
+
bbox = tightbbox.transformed(fig.transFigure.inverted())
|
| 650 |
+
return pos, bbox
|
| 651 |
+
|
| 652 |
+
|
| 653 |
+
def reposition_axes(layoutgrids, fig, renderer, *,
|
| 654 |
+
w_pad=0, h_pad=0, hspace=0, wspace=0):
|
| 655 |
+
"""
|
| 656 |
+
Reposition all the Axes based on the new inner bounding box.
|
| 657 |
+
"""
|
| 658 |
+
trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
|
| 659 |
+
for sfig in fig.subfigs:
|
| 660 |
+
bbox = layoutgrids[sfig].get_outer_bbox()
|
| 661 |
+
sfig._redo_transform_rel_fig(
|
| 662 |
+
bbox=bbox.transformed(trans_fig_to_subfig))
|
| 663 |
+
reposition_axes(layoutgrids, sfig, renderer,
|
| 664 |
+
w_pad=w_pad, h_pad=h_pad,
|
| 665 |
+
wspace=wspace, hspace=hspace)
|
| 666 |
+
|
| 667 |
+
for ax in fig._localaxes:
|
| 668 |
+
if ax.get_subplotspec() is None or not ax.get_in_layout():
|
| 669 |
+
continue
|
| 670 |
+
|
| 671 |
+
# grid bbox is in Figure coordinates, but we specify in panel
|
| 672 |
+
# coordinates...
|
| 673 |
+
ss = ax.get_subplotspec()
|
| 674 |
+
gs = ss.get_gridspec()
|
| 675 |
+
if gs not in layoutgrids:
|
| 676 |
+
return
|
| 677 |
+
|
| 678 |
+
bbox = layoutgrids[gs].get_inner_bbox(rows=ss.rowspan,
|
| 679 |
+
cols=ss.colspan)
|
| 680 |
+
|
| 681 |
+
# transform from figure to panel for set_position:
|
| 682 |
+
newbbox = trans_fig_to_subfig.transform_bbox(bbox)
|
| 683 |
+
ax._set_position(newbbox)
|
| 684 |
+
|
| 685 |
+
# move the colorbars:
|
| 686 |
+
# we need to keep track of oldw and oldh if there is more than
|
| 687 |
+
# one colorbar:
|
| 688 |
+
offset = {'left': 0, 'right': 0, 'bottom': 0, 'top': 0}
|
| 689 |
+
for nn, cbax in enumerate(ax._colorbars[::-1]):
|
| 690 |
+
if ax == cbax._colorbar_info['parents'][0]:
|
| 691 |
+
reposition_colorbar(layoutgrids, cbax, renderer,
|
| 692 |
+
offset=offset)
|
| 693 |
+
|
| 694 |
+
|
| 695 |
+
def reposition_colorbar(layoutgrids, cbax, renderer, *, offset=None):
|
| 696 |
+
"""
|
| 697 |
+
Place the colorbar in its new place.
|
| 698 |
+
|
| 699 |
+
Parameters
|
| 700 |
+
----------
|
| 701 |
+
layoutgrids : dict
|
| 702 |
+
cbax : `~matplotlib.axes.Axes`
|
| 703 |
+
Axes for the colorbar.
|
| 704 |
+
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
|
| 705 |
+
The renderer to use.
|
| 706 |
+
offset : array-like
|
| 707 |
+
Offset the colorbar needs to be pushed to in order to
|
| 708 |
+
account for multiple colorbars.
|
| 709 |
+
"""
|
| 710 |
+
|
| 711 |
+
parents = cbax._colorbar_info['parents']
|
| 712 |
+
gs = parents[0].get_gridspec()
|
| 713 |
+
fig = cbax.get_figure(root=False)
|
| 714 |
+
trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
|
| 715 |
+
|
| 716 |
+
cb_rspans, cb_cspans = get_cb_parent_spans(cbax)
|
| 717 |
+
bboxparent = layoutgrids[gs].get_bbox_for_cb(rows=cb_rspans,
|
| 718 |
+
cols=cb_cspans)
|
| 719 |
+
pb = layoutgrids[gs].get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
|
| 720 |
+
|
| 721 |
+
location = cbax._colorbar_info['location']
|
| 722 |
+
anchor = cbax._colorbar_info['anchor']
|
| 723 |
+
fraction = cbax._colorbar_info['fraction']
|
| 724 |
+
aspect = cbax._colorbar_info['aspect']
|
| 725 |
+
shrink = cbax._colorbar_info['shrink']
|
| 726 |
+
|
| 727 |
+
cbpos, cbbbox = get_pos_and_bbox(cbax, renderer)
|
| 728 |
+
|
| 729 |
+
# Colorbar gets put at extreme edge of outer bbox of the subplotspec
|
| 730 |
+
# It needs to be moved in by: 1) a pad 2) its "margin" 3) by
|
| 731 |
+
# any colorbars already added at this location:
|
| 732 |
+
cbpad = colorbar_get_pad(layoutgrids, cbax)
|
| 733 |
+
if location in ('left', 'right'):
|
| 734 |
+
# fraction and shrink are fractions of parent
|
| 735 |
+
pbcb = pb.shrunk(fraction, shrink).anchored(anchor, pb)
|
| 736 |
+
# The colorbar is at the left side of the parent. Need
|
| 737 |
+
# to translate to right (or left)
|
| 738 |
+
if location == 'right':
|
| 739 |
+
lmargin = cbpos.x0 - cbbbox.x0
|
| 740 |
+
dx = bboxparent.x1 - pbcb.x0 + offset['right']
|
| 741 |
+
dx += cbpad + lmargin
|
| 742 |
+
offset['right'] += cbbbox.width + cbpad
|
| 743 |
+
pbcb = pbcb.translated(dx, 0)
|
| 744 |
+
else:
|
| 745 |
+
lmargin = cbpos.x0 - cbbbox.x0
|
| 746 |
+
dx = bboxparent.x0 - pbcb.x0 # edge of parent
|
| 747 |
+
dx += -cbbbox.width - cbpad + lmargin - offset['left']
|
| 748 |
+
offset['left'] += cbbbox.width + cbpad
|
| 749 |
+
pbcb = pbcb.translated(dx, 0)
|
| 750 |
+
else: # horizontal axes:
|
| 751 |
+
pbcb = pb.shrunk(shrink, fraction).anchored(anchor, pb)
|
| 752 |
+
if location == 'top':
|
| 753 |
+
bmargin = cbpos.y0 - cbbbox.y0
|
| 754 |
+
dy = bboxparent.y1 - pbcb.y0 + offset['top']
|
| 755 |
+
dy += cbpad + bmargin
|
| 756 |
+
offset['top'] += cbbbox.height + cbpad
|
| 757 |
+
pbcb = pbcb.translated(0, dy)
|
| 758 |
+
else:
|
| 759 |
+
bmargin = cbpos.y0 - cbbbox.y0
|
| 760 |
+
dy = bboxparent.y0 - pbcb.y0
|
| 761 |
+
dy += -cbbbox.height - cbpad + bmargin - offset['bottom']
|
| 762 |
+
offset['bottom'] += cbbbox.height + cbpad
|
| 763 |
+
pbcb = pbcb.translated(0, dy)
|
| 764 |
+
|
| 765 |
+
pbcb = trans_fig_to_subfig.transform_bbox(pbcb)
|
| 766 |
+
cbax.set_transform(fig.transSubfigure)
|
| 767 |
+
cbax._set_position(pbcb)
|
| 768 |
+
cbax.set_anchor(anchor)
|
| 769 |
+
if location in ['bottom', 'top']:
|
| 770 |
+
aspect = 1 / aspect
|
| 771 |
+
cbax.set_box_aspect(aspect)
|
| 772 |
+
cbax.set_aspect('auto')
|
| 773 |
+
return offset
|
| 774 |
+
|
| 775 |
+
|
| 776 |
+
def reset_margins(layoutgrids, fig):
|
| 777 |
+
"""
|
| 778 |
+
Reset the margins in the layoutboxes of *fig*.
|
| 779 |
+
|
| 780 |
+
Margins are usually set as a minimum, so if the figure gets smaller
|
| 781 |
+
the minimum needs to be zero in order for it to grow again.
|
| 782 |
+
"""
|
| 783 |
+
for sfig in fig.subfigs:
|
| 784 |
+
reset_margins(layoutgrids, sfig)
|
| 785 |
+
for ax in fig.axes:
|
| 786 |
+
if ax.get_in_layout():
|
| 787 |
+
gs = ax.get_gridspec()
|
| 788 |
+
if gs in layoutgrids: # also implies gs is not None.
|
| 789 |
+
layoutgrids[gs].reset_margins()
|
| 790 |
+
layoutgrids[fig].reset_margins()
|
| 791 |
+
|
| 792 |
+
|
| 793 |
+
def colorbar_get_pad(layoutgrids, cax):
|
| 794 |
+
parents = cax._colorbar_info['parents']
|
| 795 |
+
gs = parents[0].get_gridspec()
|
| 796 |
+
|
| 797 |
+
cb_rspans, cb_cspans = get_cb_parent_spans(cax)
|
| 798 |
+
bboxouter = layoutgrids[gs].get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
|
| 799 |
+
|
| 800 |
+
if cax._colorbar_info['location'] in ['right', 'left']:
|
| 801 |
+
size = bboxouter.width
|
| 802 |
+
else:
|
| 803 |
+
size = bboxouter.height
|
| 804 |
+
|
| 805 |
+
return cax._colorbar_info['pad'] * size
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_docstring.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
|
| 3 |
+
from . import _api
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def kwarg_doc(text):
|
| 7 |
+
"""
|
| 8 |
+
Decorator for defining the kwdoc documentation of artist properties.
|
| 9 |
+
|
| 10 |
+
This decorator can be applied to artist property setter methods.
|
| 11 |
+
The given text is stored in a private attribute ``_kwarg_doc`` on
|
| 12 |
+
the method. It is used to overwrite auto-generated documentation
|
| 13 |
+
in the *kwdoc list* for artists. The kwdoc list is used to document
|
| 14 |
+
``**kwargs`` when they are properties of an artist. See e.g. the
|
| 15 |
+
``**kwargs`` section in `.Axes.text`.
|
| 16 |
+
|
| 17 |
+
The text should contain the supported types, as well as the default
|
| 18 |
+
value if applicable, e.g.:
|
| 19 |
+
|
| 20 |
+
@_docstring.kwarg_doc("bool, default: :rc:`text.usetex`")
|
| 21 |
+
def set_usetex(self, usetex):
|
| 22 |
+
|
| 23 |
+
See Also
|
| 24 |
+
--------
|
| 25 |
+
matplotlib.artist.kwdoc
|
| 26 |
+
|
| 27 |
+
"""
|
| 28 |
+
def decorator(func):
|
| 29 |
+
func._kwarg_doc = text
|
| 30 |
+
return func
|
| 31 |
+
return decorator
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class Substitution:
|
| 35 |
+
"""
|
| 36 |
+
A decorator that performs %-substitution on an object's docstring.
|
| 37 |
+
|
| 38 |
+
This decorator should be robust even if ``obj.__doc__`` is None (for
|
| 39 |
+
example, if -OO was passed to the interpreter).
|
| 40 |
+
|
| 41 |
+
Usage: construct a docstring.Substitution with a sequence or dictionary
|
| 42 |
+
suitable for performing substitution; then decorate a suitable function
|
| 43 |
+
with the constructed object, e.g.::
|
| 44 |
+
|
| 45 |
+
sub_author_name = Substitution(author='Jason')
|
| 46 |
+
|
| 47 |
+
@sub_author_name
|
| 48 |
+
def some_function(x):
|
| 49 |
+
"%(author)s wrote this function"
|
| 50 |
+
|
| 51 |
+
# note that some_function.__doc__ is now "Jason wrote this function"
|
| 52 |
+
|
| 53 |
+
One can also use positional arguments::
|
| 54 |
+
|
| 55 |
+
sub_first_last_names = Substitution('Edgar Allen', 'Poe')
|
| 56 |
+
|
| 57 |
+
@sub_first_last_names
|
| 58 |
+
def some_function(x):
|
| 59 |
+
"%s %s wrote the Raven"
|
| 60 |
+
"""
|
| 61 |
+
def __init__(self, *args, **kwargs):
|
| 62 |
+
if args and kwargs:
|
| 63 |
+
raise TypeError("Only positional or keyword args are allowed")
|
| 64 |
+
self.params = args or kwargs
|
| 65 |
+
|
| 66 |
+
def __call__(self, func):
|
| 67 |
+
if func.__doc__:
|
| 68 |
+
func.__doc__ = inspect.cleandoc(func.__doc__) % self.params
|
| 69 |
+
return func
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class _ArtistKwdocLoader(dict):
|
| 73 |
+
def __missing__(self, key):
|
| 74 |
+
if not key.endswith(":kwdoc"):
|
| 75 |
+
raise KeyError(key)
|
| 76 |
+
name = key[:-len(":kwdoc")]
|
| 77 |
+
from matplotlib.artist import Artist, kwdoc
|
| 78 |
+
try:
|
| 79 |
+
cls, = (cls for cls in _api.recursive_subclasses(Artist)
|
| 80 |
+
if cls.__name__ == name)
|
| 81 |
+
except ValueError as e:
|
| 82 |
+
raise KeyError(key) from e
|
| 83 |
+
return self.setdefault(key, kwdoc(cls))
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class _ArtistPropertiesSubstitution:
|
| 87 |
+
"""
|
| 88 |
+
A class to substitute formatted placeholders in docstrings.
|
| 89 |
+
|
| 90 |
+
This is realized in a single instance ``_docstring.interpd``.
|
| 91 |
+
|
| 92 |
+
Use `~._ArtistPropertiesSubstition.register` to define placeholders and
|
| 93 |
+
their substitution, e.g. ``_docstring.interpd.register(name="some value")``.
|
| 94 |
+
|
| 95 |
+
Use this as a decorator to apply the substitution::
|
| 96 |
+
|
| 97 |
+
@_docstring.interpd
|
| 98 |
+
def some_func():
|
| 99 |
+
'''Replace %(name)s.'''
|
| 100 |
+
|
| 101 |
+
Decorating a class triggers substitution both on the class docstring and
|
| 102 |
+
on the class' ``__init__`` docstring (which is a commonly required
|
| 103 |
+
pattern for Artist subclasses).
|
| 104 |
+
|
| 105 |
+
Substitutions of the form ``%(classname:kwdoc)s`` (ending with the
|
| 106 |
+
literal ":kwdoc" suffix) trigger lookup of an Artist subclass with the
|
| 107 |
+
given *classname*, and are substituted with the `.kwdoc` of that class.
|
| 108 |
+
"""
|
| 109 |
+
|
| 110 |
+
def __init__(self):
|
| 111 |
+
self.params = _ArtistKwdocLoader()
|
| 112 |
+
|
| 113 |
+
def register(self, **kwargs):
|
| 114 |
+
"""
|
| 115 |
+
Register substitutions.
|
| 116 |
+
|
| 117 |
+
``_docstring.interpd.register(name="some value")`` makes "name" available
|
| 118 |
+
as a named parameter that will be replaced by "some value".
|
| 119 |
+
"""
|
| 120 |
+
self.params.update(**kwargs)
|
| 121 |
+
|
| 122 |
+
def __call__(self, obj):
|
| 123 |
+
if obj.__doc__:
|
| 124 |
+
obj.__doc__ = inspect.cleandoc(obj.__doc__) % self.params
|
| 125 |
+
if isinstance(obj, type) and obj.__init__ != object.__init__:
|
| 126 |
+
self(obj.__init__)
|
| 127 |
+
return obj
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def copy(source):
|
| 131 |
+
"""Copy a docstring from another source function (if present)."""
|
| 132 |
+
def do_copy(target):
|
| 133 |
+
if source.__doc__:
|
| 134 |
+
target.__doc__ = source.__doc__
|
| 135 |
+
return target
|
| 136 |
+
return do_copy
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
# Create a decorator that will house the various docstring snippets reused
|
| 140 |
+
# throughout Matplotlib.
|
| 141 |
+
interpd = _ArtistPropertiesSubstitution()
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_docstring.pyi
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable
|
| 2 |
+
from typing import Any, TypeVar, overload
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
_T = TypeVar('_T')
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def kwarg_doc(text: str) -> Callable[[_T], _T]: ...
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Substitution:
|
| 12 |
+
@overload
|
| 13 |
+
def __init__(self, *args: str): ...
|
| 14 |
+
@overload
|
| 15 |
+
def __init__(self, **kwargs: str): ...
|
| 16 |
+
def __call__(self, func: _T) -> _T: ...
|
| 17 |
+
def update(self, *args, **kwargs): ... # type: ignore[no-untyped-def]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class _ArtistKwdocLoader(dict[str, str]):
|
| 21 |
+
def __missing__(self, key: str) -> str: ...
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class _ArtistPropertiesSubstitution:
|
| 25 |
+
def __init__(self) -> None: ...
|
| 26 |
+
def register(self, **kwargs) -> None: ...
|
| 27 |
+
def __call__(self, obj: _T) -> _T: ...
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def copy(source: Any) -> Callable[[_T], _T]: ...
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
dedent_interpd: _ArtistPropertiesSubstitution
|
| 34 |
+
interpd: _ArtistPropertiesSubstitution
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_enums.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Enums representing sets of strings that Matplotlib uses as input parameters.
|
| 3 |
+
|
| 4 |
+
Matplotlib often uses simple data types like strings or tuples to define a
|
| 5 |
+
concept; e.g. the line capstyle can be specified as one of 'butt', 'round',
|
| 6 |
+
or 'projecting'. The classes in this module are used internally and serve to
|
| 7 |
+
document these concepts formally.
|
| 8 |
+
|
| 9 |
+
As an end-user you will not use these classes directly, but only the values
|
| 10 |
+
they define.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from enum import Enum
|
| 14 |
+
from matplotlib import _docstring
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class JoinStyle(str, Enum):
|
| 18 |
+
"""
|
| 19 |
+
Define how the connection between two line segments is drawn.
|
| 20 |
+
|
| 21 |
+
For a visual impression of each *JoinStyle*, `view these docs online
|
| 22 |
+
<JoinStyle>`, or run `JoinStyle.demo`.
|
| 23 |
+
|
| 24 |
+
Lines in Matplotlib are typically defined by a 1D `~.path.Path` and a
|
| 25 |
+
finite ``linewidth``, where the underlying 1D `~.path.Path` represents the
|
| 26 |
+
center of the stroked line.
|
| 27 |
+
|
| 28 |
+
By default, `~.backend_bases.GraphicsContextBase` defines the boundaries of
|
| 29 |
+
a stroked line to simply be every point within some radius,
|
| 30 |
+
``linewidth/2``, away from any point of the center line. However, this
|
| 31 |
+
results in corners appearing "rounded", which may not be the desired
|
| 32 |
+
behavior if you are drawing, for example, a polygon or pointed star.
|
| 33 |
+
|
| 34 |
+
**Supported values:**
|
| 35 |
+
|
| 36 |
+
.. rst-class:: value-list
|
| 37 |
+
|
| 38 |
+
'miter'
|
| 39 |
+
the "arrow-tip" style. Each boundary of the filled-in area will
|
| 40 |
+
extend in a straight line parallel to the tangent vector of the
|
| 41 |
+
centerline at the point it meets the corner, until they meet in a
|
| 42 |
+
sharp point.
|
| 43 |
+
'round'
|
| 44 |
+
stokes every point within a radius of ``linewidth/2`` of the center
|
| 45 |
+
lines.
|
| 46 |
+
'bevel'
|
| 47 |
+
the "squared-off" style. It can be thought of as a rounded corner
|
| 48 |
+
where the "circular" part of the corner has been cut off.
|
| 49 |
+
|
| 50 |
+
.. note::
|
| 51 |
+
|
| 52 |
+
Very long miter tips are cut off (to form a *bevel*) after a
|
| 53 |
+
backend-dependent limit called the "miter limit", which specifies the
|
| 54 |
+
maximum allowed ratio of miter length to line width. For example, the
|
| 55 |
+
PDF backend uses the default value of 10 specified by the PDF standard,
|
| 56 |
+
while the SVG backend does not even specify the miter limit, resulting
|
| 57 |
+
in a default value of 4 per the SVG specification. Matplotlib does not
|
| 58 |
+
currently allow the user to adjust this parameter.
|
| 59 |
+
|
| 60 |
+
A more detailed description of the effect of a miter limit can be found
|
| 61 |
+
in the `Mozilla Developer Docs
|
| 62 |
+
<https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit>`_
|
| 63 |
+
|
| 64 |
+
.. plot::
|
| 65 |
+
:alt: Demo of possible JoinStyle's
|
| 66 |
+
|
| 67 |
+
from matplotlib._enums import JoinStyle
|
| 68 |
+
JoinStyle.demo()
|
| 69 |
+
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
miter = "miter"
|
| 73 |
+
round = "round"
|
| 74 |
+
bevel = "bevel"
|
| 75 |
+
|
| 76 |
+
@staticmethod
|
| 77 |
+
def demo():
|
| 78 |
+
"""Demonstrate how each JoinStyle looks for various join angles."""
|
| 79 |
+
import numpy as np
|
| 80 |
+
import matplotlib.pyplot as plt
|
| 81 |
+
|
| 82 |
+
def plot_angle(ax, x, y, angle, style):
|
| 83 |
+
phi = np.radians(angle)
|
| 84 |
+
xx = [x + .5, x, x + .5*np.cos(phi)]
|
| 85 |
+
yy = [y, y, y + .5*np.sin(phi)]
|
| 86 |
+
ax.plot(xx, yy, lw=12, color='tab:blue', solid_joinstyle=style)
|
| 87 |
+
ax.plot(xx, yy, lw=1, color='black')
|
| 88 |
+
ax.plot(xx[1], yy[1], 'o', color='tab:red', markersize=3)
|
| 89 |
+
|
| 90 |
+
fig, ax = plt.subplots(figsize=(5, 4), constrained_layout=True)
|
| 91 |
+
ax.set_title('Join style')
|
| 92 |
+
for x, style in enumerate(['miter', 'round', 'bevel']):
|
| 93 |
+
ax.text(x, 5, style)
|
| 94 |
+
for y, angle in enumerate([20, 45, 60, 90, 120]):
|
| 95 |
+
plot_angle(ax, x, y, angle, style)
|
| 96 |
+
if x == 0:
|
| 97 |
+
ax.text(-1.3, y, f'{angle} degrees')
|
| 98 |
+
ax.set_xlim(-1.5, 2.75)
|
| 99 |
+
ax.set_ylim(-.5, 5.5)
|
| 100 |
+
ax.set_axis_off()
|
| 101 |
+
fig.show()
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
JoinStyle.input_description = "{" \
|
| 105 |
+
+ ", ".join([f"'{js.name}'" for js in JoinStyle]) \
|
| 106 |
+
+ "}"
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class CapStyle(str, Enum):
|
| 110 |
+
r"""
|
| 111 |
+
Define how the two endpoints (caps) of an unclosed line are drawn.
|
| 112 |
+
|
| 113 |
+
How to draw the start and end points of lines that represent a closed curve
|
| 114 |
+
(i.e. that end in a `~.path.Path.CLOSEPOLY`) is controlled by the line's
|
| 115 |
+
`JoinStyle`. For all other lines, how the start and end points are drawn is
|
| 116 |
+
controlled by the *CapStyle*.
|
| 117 |
+
|
| 118 |
+
For a visual impression of each *CapStyle*, `view these docs online
|
| 119 |
+
<CapStyle>` or run `CapStyle.demo`.
|
| 120 |
+
|
| 121 |
+
By default, `~.backend_bases.GraphicsContextBase` draws a stroked line as
|
| 122 |
+
squared off at its endpoints.
|
| 123 |
+
|
| 124 |
+
**Supported values:**
|
| 125 |
+
|
| 126 |
+
.. rst-class:: value-list
|
| 127 |
+
|
| 128 |
+
'butt'
|
| 129 |
+
the line is squared off at its endpoint.
|
| 130 |
+
'projecting'
|
| 131 |
+
the line is squared off as in *butt*, but the filled in area
|
| 132 |
+
extends beyond the endpoint a distance of ``linewidth/2``.
|
| 133 |
+
'round'
|
| 134 |
+
like *butt*, but a semicircular cap is added to the end of the
|
| 135 |
+
line, of radius ``linewidth/2``.
|
| 136 |
+
|
| 137 |
+
.. plot::
|
| 138 |
+
:alt: Demo of possible CapStyle's
|
| 139 |
+
|
| 140 |
+
from matplotlib._enums import CapStyle
|
| 141 |
+
CapStyle.demo()
|
| 142 |
+
|
| 143 |
+
"""
|
| 144 |
+
butt = "butt"
|
| 145 |
+
projecting = "projecting"
|
| 146 |
+
round = "round"
|
| 147 |
+
|
| 148 |
+
@staticmethod
|
| 149 |
+
def demo():
|
| 150 |
+
"""Demonstrate how each CapStyle looks for a thick line segment."""
|
| 151 |
+
import matplotlib.pyplot as plt
|
| 152 |
+
|
| 153 |
+
fig = plt.figure(figsize=(4, 1.2))
|
| 154 |
+
ax = fig.add_axes([0, 0, 1, 0.8])
|
| 155 |
+
ax.set_title('Cap style')
|
| 156 |
+
|
| 157 |
+
for x, style in enumerate(['butt', 'round', 'projecting']):
|
| 158 |
+
ax.text(x+0.25, 0.85, style, ha='center')
|
| 159 |
+
xx = [x, x+0.5]
|
| 160 |
+
yy = [0, 0]
|
| 161 |
+
ax.plot(xx, yy, lw=12, color='tab:blue', solid_capstyle=style)
|
| 162 |
+
ax.plot(xx, yy, lw=1, color='black')
|
| 163 |
+
ax.plot(xx, yy, 'o', color='tab:red', markersize=3)
|
| 164 |
+
|
| 165 |
+
ax.set_ylim(-.5, 1.5)
|
| 166 |
+
ax.set_axis_off()
|
| 167 |
+
fig.show()
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
CapStyle.input_description = "{" \
|
| 171 |
+
+ ", ".join([f"'{cs.name}'" for cs in CapStyle]) \
|
| 172 |
+
+ "}"
|
| 173 |
+
|
| 174 |
+
_docstring.interpd.register(
|
| 175 |
+
JoinStyle=JoinStyle.input_description,
|
| 176 |
+
CapStyle=CapStyle.input_description,
|
| 177 |
+
)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_enums.pyi
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import cast
|
| 2 |
+
from enum import Enum
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class JoinStyle(str, Enum):
|
| 6 |
+
miter = "miter"
|
| 7 |
+
round = "round"
|
| 8 |
+
bevel = "bevel"
|
| 9 |
+
@staticmethod
|
| 10 |
+
def demo() -> None: ...
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class CapStyle(str, Enum):
|
| 14 |
+
butt = "butt"
|
| 15 |
+
projecting = "projecting"
|
| 16 |
+
round = "round"
|
| 17 |
+
|
| 18 |
+
@staticmethod
|
| 19 |
+
def demo() -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A module for parsing and generating `fontconfig patterns`_.
|
| 3 |
+
|
| 4 |
+
.. _fontconfig patterns:
|
| 5 |
+
https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
# This class logically belongs in `matplotlib.font_manager`, but placing it
|
| 9 |
+
# there would have created cyclical dependency problems, because it also needs
|
| 10 |
+
# to be available from `matplotlib.rcsetup` (for parsing matplotlibrc files).
|
| 11 |
+
|
| 12 |
+
from functools import lru_cache, partial
|
| 13 |
+
import re
|
| 14 |
+
|
| 15 |
+
from pyparsing import (
|
| 16 |
+
Group, Optional, ParseException, Regex, StringEnd, Suppress, ZeroOrMore, one_of)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
_family_punc = r'\\\-:,'
|
| 20 |
+
_family_unescape = partial(re.compile(r'\\(?=[%s])' % _family_punc).sub, '')
|
| 21 |
+
_family_escape = partial(re.compile(r'(?=[%s])' % _family_punc).sub, r'\\')
|
| 22 |
+
_value_punc = r'\\=_:,'
|
| 23 |
+
_value_unescape = partial(re.compile(r'\\(?=[%s])' % _value_punc).sub, '')
|
| 24 |
+
_value_escape = partial(re.compile(r'(?=[%s])' % _value_punc).sub, r'\\')
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
_CONSTANTS = {
|
| 28 |
+
'thin': ('weight', 'light'),
|
| 29 |
+
'extralight': ('weight', 'light'),
|
| 30 |
+
'ultralight': ('weight', 'light'),
|
| 31 |
+
'light': ('weight', 'light'),
|
| 32 |
+
'book': ('weight', 'book'),
|
| 33 |
+
'regular': ('weight', 'regular'),
|
| 34 |
+
'normal': ('weight', 'normal'),
|
| 35 |
+
'medium': ('weight', 'medium'),
|
| 36 |
+
'demibold': ('weight', 'demibold'),
|
| 37 |
+
'semibold': ('weight', 'semibold'),
|
| 38 |
+
'bold': ('weight', 'bold'),
|
| 39 |
+
'extrabold': ('weight', 'extra bold'),
|
| 40 |
+
'black': ('weight', 'black'),
|
| 41 |
+
'heavy': ('weight', 'heavy'),
|
| 42 |
+
'roman': ('slant', 'normal'),
|
| 43 |
+
'italic': ('slant', 'italic'),
|
| 44 |
+
'oblique': ('slant', 'oblique'),
|
| 45 |
+
'ultracondensed': ('width', 'ultra-condensed'),
|
| 46 |
+
'extracondensed': ('width', 'extra-condensed'),
|
| 47 |
+
'condensed': ('width', 'condensed'),
|
| 48 |
+
'semicondensed': ('width', 'semi-condensed'),
|
| 49 |
+
'expanded': ('width', 'expanded'),
|
| 50 |
+
'extraexpanded': ('width', 'extra-expanded'),
|
| 51 |
+
'ultraexpanded': ('width', 'ultra-expanded'),
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
@lru_cache # The parser instance is a singleton.
|
| 56 |
+
def _make_fontconfig_parser():
|
| 57 |
+
def comma_separated(elem):
|
| 58 |
+
return elem + ZeroOrMore(Suppress(",") + elem)
|
| 59 |
+
|
| 60 |
+
family = Regex(fr"([^{_family_punc}]|(\\[{_family_punc}]))*")
|
| 61 |
+
size = Regex(r"([0-9]+\.?[0-9]*|\.[0-9]+)")
|
| 62 |
+
name = Regex(r"[a-z]+")
|
| 63 |
+
value = Regex(fr"([^{_value_punc}]|(\\[{_value_punc}]))*")
|
| 64 |
+
prop = Group((name + Suppress("=") + comma_separated(value)) | one_of(_CONSTANTS))
|
| 65 |
+
return (
|
| 66 |
+
Optional(comma_separated(family)("families"))
|
| 67 |
+
+ Optional("-" + comma_separated(size)("sizes"))
|
| 68 |
+
+ ZeroOrMore(":" + prop("properties*"))
|
| 69 |
+
+ StringEnd()
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
# `parse_fontconfig_pattern` is a bottleneck during the tests because it is
|
| 74 |
+
# repeatedly called when the rcParams are reset (to validate the default
|
| 75 |
+
# fonts). In practice, the cache size doesn't grow beyond a few dozen entries
|
| 76 |
+
# during the test suite.
|
| 77 |
+
@lru_cache
|
| 78 |
+
def parse_fontconfig_pattern(pattern):
|
| 79 |
+
"""
|
| 80 |
+
Parse a fontconfig *pattern* into a dict that can initialize a
|
| 81 |
+
`.font_manager.FontProperties` object.
|
| 82 |
+
"""
|
| 83 |
+
parser = _make_fontconfig_parser()
|
| 84 |
+
try:
|
| 85 |
+
parse = parser.parse_string(pattern)
|
| 86 |
+
except ParseException as err:
|
| 87 |
+
# explain becomes a plain method on pyparsing 3 (err.explain(0)).
|
| 88 |
+
raise ValueError("\n" + ParseException.explain(err, 0)) from None
|
| 89 |
+
parser.reset_cache()
|
| 90 |
+
props = {}
|
| 91 |
+
if "families" in parse:
|
| 92 |
+
props["family"] = [*map(_family_unescape, parse["families"])]
|
| 93 |
+
if "sizes" in parse:
|
| 94 |
+
props["size"] = [*parse["sizes"]]
|
| 95 |
+
for prop in parse.get("properties", []):
|
| 96 |
+
if len(prop) == 1:
|
| 97 |
+
prop = _CONSTANTS[prop[0]]
|
| 98 |
+
k, *v = prop
|
| 99 |
+
props.setdefault(k, []).extend(map(_value_unescape, v))
|
| 100 |
+
return props
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def generate_fontconfig_pattern(d):
|
| 104 |
+
"""Convert a `.FontProperties` to a fontconfig pattern string."""
|
| 105 |
+
kvs = [(k, getattr(d, f"get_{k}")())
|
| 106 |
+
for k in ["style", "variant", "weight", "stretch", "file", "size"]]
|
| 107 |
+
# Families is given first without a leading keyword. Other entries (which
|
| 108 |
+
# are necessarily scalar) are given as key=value, skipping Nones.
|
| 109 |
+
return (",".join(_family_escape(f) for f in d.get_family())
|
| 110 |
+
+ "".join(f":{k}={_value_escape(str(v))}"
|
| 111 |
+
for k, v in kvs if v is not None))
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_image.pyi
ADDED
|
File without changes
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_internal_utils.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Internal debugging utilities, that are not expected to be used in the rest of
|
| 3 |
+
the codebase.
|
| 4 |
+
|
| 5 |
+
WARNING: Code in this module may change without prior notice!
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from io import StringIO
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
import subprocess
|
| 11 |
+
|
| 12 |
+
from matplotlib.transforms import TransformNode
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def graphviz_dump_transform(transform, dest, *, highlight=None):
|
| 16 |
+
"""
|
| 17 |
+
Generate a graphical representation of the transform tree for *transform*
|
| 18 |
+
using the :program:`dot` program (which this function depends on). The
|
| 19 |
+
output format (png, dot, etc.) is determined from the suffix of *dest*.
|
| 20 |
+
|
| 21 |
+
Parameters
|
| 22 |
+
----------
|
| 23 |
+
transform : `~matplotlib.transform.Transform`
|
| 24 |
+
The represented transform.
|
| 25 |
+
dest : str
|
| 26 |
+
Output filename. The extension must be one of the formats supported
|
| 27 |
+
by :program:`dot`, e.g. png, svg, dot, ...
|
| 28 |
+
(see https://www.graphviz.org/doc/info/output.html).
|
| 29 |
+
highlight : list of `~matplotlib.transform.Transform` or None
|
| 30 |
+
The transforms in the tree to be drawn in bold.
|
| 31 |
+
If *None*, *transform* is highlighted.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
if highlight is None:
|
| 35 |
+
highlight = [transform]
|
| 36 |
+
seen = set()
|
| 37 |
+
|
| 38 |
+
def recurse(root, buf):
|
| 39 |
+
if id(root) in seen:
|
| 40 |
+
return
|
| 41 |
+
seen.add(id(root))
|
| 42 |
+
props = {}
|
| 43 |
+
label = type(root).__name__
|
| 44 |
+
if root._invalid:
|
| 45 |
+
label = f'[{label}]'
|
| 46 |
+
if root in highlight:
|
| 47 |
+
props['style'] = 'bold'
|
| 48 |
+
props['shape'] = 'box'
|
| 49 |
+
props['label'] = '"%s"' % label
|
| 50 |
+
props = ' '.join(map('{0[0]}={0[1]}'.format, props.items()))
|
| 51 |
+
buf.write(f'{id(root)} [{props}];\n')
|
| 52 |
+
for key, val in vars(root).items():
|
| 53 |
+
if isinstance(val, TransformNode) and id(root) in val._parents:
|
| 54 |
+
buf.write(f'"{id(root)}" -> "{id(val)}" '
|
| 55 |
+
f'[label="{key}", fontsize=10];\n')
|
| 56 |
+
recurse(val, buf)
|
| 57 |
+
|
| 58 |
+
buf = StringIO()
|
| 59 |
+
buf.write('digraph G {\n')
|
| 60 |
+
recurse(transform, buf)
|
| 61 |
+
buf.write('}\n')
|
| 62 |
+
subprocess.run(
|
| 63 |
+
['dot', '-T', Path(dest).suffix[1:], '-o', dest],
|
| 64 |
+
input=buf.getvalue().encode('utf-8'), check=True)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_layoutgrid.py
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A layoutgrid is a nrows by ncols set of boxes, meant to be used by
|
| 3 |
+
`._constrained_layout`, each box is analogous to a subplotspec element of
|
| 4 |
+
a gridspec.
|
| 5 |
+
|
| 6 |
+
Each box is defined by left[ncols], right[ncols], bottom[nrows] and top[nrows],
|
| 7 |
+
and by two editable margins for each side. The main margin gets its value
|
| 8 |
+
set by the size of ticklabels, titles, etc on each Axes that is in the figure.
|
| 9 |
+
The outer margin is the padding around the Axes, and space for any
|
| 10 |
+
colorbars.
|
| 11 |
+
|
| 12 |
+
The "inner" widths and heights of these boxes are then constrained to be the
|
| 13 |
+
same (relative the values of `width_ratios[ncols]` and `height_ratios[nrows]`).
|
| 14 |
+
|
| 15 |
+
The layoutgrid is then constrained to be contained within a parent layoutgrid,
|
| 16 |
+
its column(s) and row(s) specified when it is created.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
import itertools
|
| 20 |
+
import kiwisolver as kiwi
|
| 21 |
+
import logging
|
| 22 |
+
import numpy as np
|
| 23 |
+
|
| 24 |
+
import matplotlib as mpl
|
| 25 |
+
import matplotlib.patches as mpatches
|
| 26 |
+
from matplotlib.transforms import Bbox
|
| 27 |
+
|
| 28 |
+
_log = logging.getLogger(__name__)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class LayoutGrid:
|
| 32 |
+
"""
|
| 33 |
+
Analogous to a gridspec, and contained in another LayoutGrid.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
def __init__(self, parent=None, parent_pos=(0, 0),
|
| 37 |
+
parent_inner=False, name='', ncols=1, nrows=1,
|
| 38 |
+
h_pad=None, w_pad=None, width_ratios=None,
|
| 39 |
+
height_ratios=None):
|
| 40 |
+
Variable = kiwi.Variable
|
| 41 |
+
self.parent_pos = parent_pos
|
| 42 |
+
self.parent_inner = parent_inner
|
| 43 |
+
self.name = name + seq_id()
|
| 44 |
+
if isinstance(parent, LayoutGrid):
|
| 45 |
+
self.name = f'{parent.name}.{self.name}'
|
| 46 |
+
self.nrows = nrows
|
| 47 |
+
self.ncols = ncols
|
| 48 |
+
self.height_ratios = np.atleast_1d(height_ratios)
|
| 49 |
+
if height_ratios is None:
|
| 50 |
+
self.height_ratios = np.ones(nrows)
|
| 51 |
+
self.width_ratios = np.atleast_1d(width_ratios)
|
| 52 |
+
if width_ratios is None:
|
| 53 |
+
self.width_ratios = np.ones(ncols)
|
| 54 |
+
|
| 55 |
+
sn = self.name + '_'
|
| 56 |
+
if not isinstance(parent, LayoutGrid):
|
| 57 |
+
# parent can be a rect if not a LayoutGrid
|
| 58 |
+
# allows specifying a rectangle to contain the layout.
|
| 59 |
+
self.solver = kiwi.Solver()
|
| 60 |
+
else:
|
| 61 |
+
parent.add_child(self, *parent_pos)
|
| 62 |
+
self.solver = parent.solver
|
| 63 |
+
# keep track of artist associated w/ this layout. Can be none
|
| 64 |
+
self.artists = np.empty((nrows, ncols), dtype=object)
|
| 65 |
+
self.children = np.empty((nrows, ncols), dtype=object)
|
| 66 |
+
|
| 67 |
+
self.margins = {}
|
| 68 |
+
self.margin_vals = {}
|
| 69 |
+
# all the boxes in each column share the same left/right margins:
|
| 70 |
+
for todo in ['left', 'right', 'leftcb', 'rightcb']:
|
| 71 |
+
# track the value so we can change only if a margin is larger
|
| 72 |
+
# than the current value
|
| 73 |
+
self.margin_vals[todo] = np.zeros(ncols)
|
| 74 |
+
|
| 75 |
+
sol = self.solver
|
| 76 |
+
|
| 77 |
+
self.lefts = [Variable(f'{sn}lefts[{i}]') for i in range(ncols)]
|
| 78 |
+
self.rights = [Variable(f'{sn}rights[{i}]') for i in range(ncols)]
|
| 79 |
+
for todo in ['left', 'right', 'leftcb', 'rightcb']:
|
| 80 |
+
self.margins[todo] = [Variable(f'{sn}margins[{todo}][{i}]')
|
| 81 |
+
for i in range(ncols)]
|
| 82 |
+
for i in range(ncols):
|
| 83 |
+
sol.addEditVariable(self.margins[todo][i], 'strong')
|
| 84 |
+
|
| 85 |
+
for todo in ['bottom', 'top', 'bottomcb', 'topcb']:
|
| 86 |
+
self.margins[todo] = np.empty((nrows), dtype=object)
|
| 87 |
+
self.margin_vals[todo] = np.zeros(nrows)
|
| 88 |
+
|
| 89 |
+
self.bottoms = [Variable(f'{sn}bottoms[{i}]') for i in range(nrows)]
|
| 90 |
+
self.tops = [Variable(f'{sn}tops[{i}]') for i in range(nrows)]
|
| 91 |
+
for todo in ['bottom', 'top', 'bottomcb', 'topcb']:
|
| 92 |
+
self.margins[todo] = [Variable(f'{sn}margins[{todo}][{i}]')
|
| 93 |
+
for i in range(nrows)]
|
| 94 |
+
for i in range(nrows):
|
| 95 |
+
sol.addEditVariable(self.margins[todo][i], 'strong')
|
| 96 |
+
|
| 97 |
+
# set these margins to zero by default. They will be edited as
|
| 98 |
+
# children are filled.
|
| 99 |
+
self.reset_margins()
|
| 100 |
+
self.add_constraints(parent)
|
| 101 |
+
|
| 102 |
+
self.h_pad = h_pad
|
| 103 |
+
self.w_pad = w_pad
|
| 104 |
+
|
| 105 |
+
def __repr__(self):
|
| 106 |
+
str = f'LayoutBox: {self.name:25s} {self.nrows}x{self.ncols},\n'
|
| 107 |
+
for i in range(self.nrows):
|
| 108 |
+
for j in range(self.ncols):
|
| 109 |
+
str += f'{i}, {j}: '\
|
| 110 |
+
f'L{self.lefts[j].value():1.3f}, ' \
|
| 111 |
+
f'B{self.bottoms[i].value():1.3f}, ' \
|
| 112 |
+
f'R{self.rights[j].value():1.3f}, ' \
|
| 113 |
+
f'T{self.tops[i].value():1.3f}, ' \
|
| 114 |
+
f'ML{self.margins["left"][j].value():1.3f}, ' \
|
| 115 |
+
f'MR{self.margins["right"][j].value():1.3f}, ' \
|
| 116 |
+
f'MB{self.margins["bottom"][i].value():1.3f}, ' \
|
| 117 |
+
f'MT{self.margins["top"][i].value():1.3f}, \n'
|
| 118 |
+
return str
|
| 119 |
+
|
| 120 |
+
def reset_margins(self):
|
| 121 |
+
"""
|
| 122 |
+
Reset all the margins to zero. Must do this after changing
|
| 123 |
+
figure size, for instance, because the relative size of the
|
| 124 |
+
axes labels etc changes.
|
| 125 |
+
"""
|
| 126 |
+
for todo in ['left', 'right', 'bottom', 'top',
|
| 127 |
+
'leftcb', 'rightcb', 'bottomcb', 'topcb']:
|
| 128 |
+
self.edit_margins(todo, 0.0)
|
| 129 |
+
|
| 130 |
+
def add_constraints(self, parent):
|
| 131 |
+
# define self-consistent constraints
|
| 132 |
+
self.hard_constraints()
|
| 133 |
+
# define relationship with parent layoutgrid:
|
| 134 |
+
self.parent_constraints(parent)
|
| 135 |
+
# define relative widths of the grid cells to each other
|
| 136 |
+
# and stack horizontally and vertically.
|
| 137 |
+
self.grid_constraints()
|
| 138 |
+
|
| 139 |
+
def hard_constraints(self):
|
| 140 |
+
"""
|
| 141 |
+
These are the redundant constraints, plus ones that make the
|
| 142 |
+
rest of the code easier.
|
| 143 |
+
"""
|
| 144 |
+
for i in range(self.ncols):
|
| 145 |
+
hc = [self.rights[i] >= self.lefts[i],
|
| 146 |
+
(self.rights[i] - self.margins['right'][i] -
|
| 147 |
+
self.margins['rightcb'][i] >=
|
| 148 |
+
self.lefts[i] - self.margins['left'][i] -
|
| 149 |
+
self.margins['leftcb'][i])
|
| 150 |
+
]
|
| 151 |
+
for c in hc:
|
| 152 |
+
self.solver.addConstraint(c | 'required')
|
| 153 |
+
|
| 154 |
+
for i in range(self.nrows):
|
| 155 |
+
hc = [self.tops[i] >= self.bottoms[i],
|
| 156 |
+
(self.tops[i] - self.margins['top'][i] -
|
| 157 |
+
self.margins['topcb'][i] >=
|
| 158 |
+
self.bottoms[i] - self.margins['bottom'][i] -
|
| 159 |
+
self.margins['bottomcb'][i])
|
| 160 |
+
]
|
| 161 |
+
for c in hc:
|
| 162 |
+
self.solver.addConstraint(c | 'required')
|
| 163 |
+
|
| 164 |
+
def add_child(self, child, i=0, j=0):
|
| 165 |
+
# np.ix_ returns the cross product of i and j indices
|
| 166 |
+
self.children[np.ix_(np.atleast_1d(i), np.atleast_1d(j))] = child
|
| 167 |
+
|
| 168 |
+
def parent_constraints(self, parent):
|
| 169 |
+
# constraints that are due to the parent...
|
| 170 |
+
# i.e. the first column's left is equal to the
|
| 171 |
+
# parent's left, the last column right equal to the
|
| 172 |
+
# parent's right...
|
| 173 |
+
if not isinstance(parent, LayoutGrid):
|
| 174 |
+
# specify a rectangle in figure coordinates
|
| 175 |
+
hc = [self.lefts[0] == parent[0],
|
| 176 |
+
self.rights[-1] == parent[0] + parent[2],
|
| 177 |
+
# top and bottom reversed order...
|
| 178 |
+
self.tops[0] == parent[1] + parent[3],
|
| 179 |
+
self.bottoms[-1] == parent[1]]
|
| 180 |
+
else:
|
| 181 |
+
rows, cols = self.parent_pos
|
| 182 |
+
rows = np.atleast_1d(rows)
|
| 183 |
+
cols = np.atleast_1d(cols)
|
| 184 |
+
|
| 185 |
+
left = parent.lefts[cols[0]]
|
| 186 |
+
right = parent.rights[cols[-1]]
|
| 187 |
+
top = parent.tops[rows[0]]
|
| 188 |
+
bottom = parent.bottoms[rows[-1]]
|
| 189 |
+
if self.parent_inner:
|
| 190 |
+
# the layout grid is contained inside the inner
|
| 191 |
+
# grid of the parent.
|
| 192 |
+
left += parent.margins['left'][cols[0]]
|
| 193 |
+
left += parent.margins['leftcb'][cols[0]]
|
| 194 |
+
right -= parent.margins['right'][cols[-1]]
|
| 195 |
+
right -= parent.margins['rightcb'][cols[-1]]
|
| 196 |
+
top -= parent.margins['top'][rows[0]]
|
| 197 |
+
top -= parent.margins['topcb'][rows[0]]
|
| 198 |
+
bottom += parent.margins['bottom'][rows[-1]]
|
| 199 |
+
bottom += parent.margins['bottomcb'][rows[-1]]
|
| 200 |
+
hc = [self.lefts[0] == left,
|
| 201 |
+
self.rights[-1] == right,
|
| 202 |
+
# from top to bottom
|
| 203 |
+
self.tops[0] == top,
|
| 204 |
+
self.bottoms[-1] == bottom]
|
| 205 |
+
for c in hc:
|
| 206 |
+
self.solver.addConstraint(c | 'required')
|
| 207 |
+
|
| 208 |
+
def grid_constraints(self):
|
| 209 |
+
# constrain the ratio of the inner part of the grids
|
| 210 |
+
# to be the same (relative to width_ratios)
|
| 211 |
+
|
| 212 |
+
# constrain widths:
|
| 213 |
+
w = (self.rights[0] - self.margins['right'][0] -
|
| 214 |
+
self.margins['rightcb'][0])
|
| 215 |
+
w = (w - self.lefts[0] - self.margins['left'][0] -
|
| 216 |
+
self.margins['leftcb'][0])
|
| 217 |
+
w0 = w / self.width_ratios[0]
|
| 218 |
+
# from left to right
|
| 219 |
+
for i in range(1, self.ncols):
|
| 220 |
+
w = (self.rights[i] - self.margins['right'][i] -
|
| 221 |
+
self.margins['rightcb'][i])
|
| 222 |
+
w = (w - self.lefts[i] - self.margins['left'][i] -
|
| 223 |
+
self.margins['leftcb'][i])
|
| 224 |
+
c = (w == w0 * self.width_ratios[i])
|
| 225 |
+
self.solver.addConstraint(c | 'strong')
|
| 226 |
+
# constrain the grid cells to be directly next to each other.
|
| 227 |
+
c = (self.rights[i - 1] == self.lefts[i])
|
| 228 |
+
self.solver.addConstraint(c | 'strong')
|
| 229 |
+
|
| 230 |
+
# constrain heights:
|
| 231 |
+
h = self.tops[0] - self.margins['top'][0] - self.margins['topcb'][0]
|
| 232 |
+
h = (h - self.bottoms[0] - self.margins['bottom'][0] -
|
| 233 |
+
self.margins['bottomcb'][0])
|
| 234 |
+
h0 = h / self.height_ratios[0]
|
| 235 |
+
# from top to bottom:
|
| 236 |
+
for i in range(1, self.nrows):
|
| 237 |
+
h = (self.tops[i] - self.margins['top'][i] -
|
| 238 |
+
self.margins['topcb'][i])
|
| 239 |
+
h = (h - self.bottoms[i] - self.margins['bottom'][i] -
|
| 240 |
+
self.margins['bottomcb'][i])
|
| 241 |
+
c = (h == h0 * self.height_ratios[i])
|
| 242 |
+
self.solver.addConstraint(c | 'strong')
|
| 243 |
+
# constrain the grid cells to be directly above each other.
|
| 244 |
+
c = (self.bottoms[i - 1] == self.tops[i])
|
| 245 |
+
self.solver.addConstraint(c | 'strong')
|
| 246 |
+
|
| 247 |
+
# Margin editing: The margins are variable and meant to
|
| 248 |
+
# contain things of a fixed size like axes labels, tick labels, titles
|
| 249 |
+
# etc
|
| 250 |
+
def edit_margin(self, todo, size, cell):
|
| 251 |
+
"""
|
| 252 |
+
Change the size of the margin for one cell.
|
| 253 |
+
|
| 254 |
+
Parameters
|
| 255 |
+
----------
|
| 256 |
+
todo : string (one of 'left', 'right', 'bottom', 'top')
|
| 257 |
+
margin to alter.
|
| 258 |
+
|
| 259 |
+
size : float
|
| 260 |
+
Size of the margin. If it is larger than the existing minimum it
|
| 261 |
+
updates the margin size. Fraction of figure size.
|
| 262 |
+
|
| 263 |
+
cell : int
|
| 264 |
+
Cell column or row to edit.
|
| 265 |
+
"""
|
| 266 |
+
self.solver.suggestValue(self.margins[todo][cell], size)
|
| 267 |
+
self.margin_vals[todo][cell] = size
|
| 268 |
+
|
| 269 |
+
def edit_margin_min(self, todo, size, cell=0):
|
| 270 |
+
"""
|
| 271 |
+
Change the minimum size of the margin for one cell.
|
| 272 |
+
|
| 273 |
+
Parameters
|
| 274 |
+
----------
|
| 275 |
+
todo : string (one of 'left', 'right', 'bottom', 'top')
|
| 276 |
+
margin to alter.
|
| 277 |
+
|
| 278 |
+
size : float
|
| 279 |
+
Minimum size of the margin . If it is larger than the
|
| 280 |
+
existing minimum it updates the margin size. Fraction of
|
| 281 |
+
figure size.
|
| 282 |
+
|
| 283 |
+
cell : int
|
| 284 |
+
Cell column or row to edit.
|
| 285 |
+
"""
|
| 286 |
+
|
| 287 |
+
if size > self.margin_vals[todo][cell]:
|
| 288 |
+
self.edit_margin(todo, size, cell)
|
| 289 |
+
|
| 290 |
+
def edit_margins(self, todo, size):
|
| 291 |
+
"""
|
| 292 |
+
Change the size of all the margin of all the cells in the layout grid.
|
| 293 |
+
|
| 294 |
+
Parameters
|
| 295 |
+
----------
|
| 296 |
+
todo : string (one of 'left', 'right', 'bottom', 'top')
|
| 297 |
+
margin to alter.
|
| 298 |
+
|
| 299 |
+
size : float
|
| 300 |
+
Size to set the margins. Fraction of figure size.
|
| 301 |
+
"""
|
| 302 |
+
|
| 303 |
+
for i in range(len(self.margin_vals[todo])):
|
| 304 |
+
self.edit_margin(todo, size, i)
|
| 305 |
+
|
| 306 |
+
def edit_all_margins_min(self, todo, size):
|
| 307 |
+
"""
|
| 308 |
+
Change the minimum size of all the margin of all
|
| 309 |
+
the cells in the layout grid.
|
| 310 |
+
|
| 311 |
+
Parameters
|
| 312 |
+
----------
|
| 313 |
+
todo : {'left', 'right', 'bottom', 'top'}
|
| 314 |
+
The margin to alter.
|
| 315 |
+
|
| 316 |
+
size : float
|
| 317 |
+
Minimum size of the margin. If it is larger than the
|
| 318 |
+
existing minimum it updates the margin size. Fraction of
|
| 319 |
+
figure size.
|
| 320 |
+
"""
|
| 321 |
+
|
| 322 |
+
for i in range(len(self.margin_vals[todo])):
|
| 323 |
+
self.edit_margin_min(todo, size, i)
|
| 324 |
+
|
| 325 |
+
def edit_outer_margin_mins(self, margin, ss):
|
| 326 |
+
"""
|
| 327 |
+
Edit all four margin minimums in one statement.
|
| 328 |
+
|
| 329 |
+
Parameters
|
| 330 |
+
----------
|
| 331 |
+
margin : dict
|
| 332 |
+
size of margins in a dict with keys 'left', 'right', 'bottom',
|
| 333 |
+
'top'
|
| 334 |
+
|
| 335 |
+
ss : SubplotSpec
|
| 336 |
+
defines the subplotspec these margins should be applied to
|
| 337 |
+
"""
|
| 338 |
+
|
| 339 |
+
self.edit_margin_min('left', margin['left'], ss.colspan.start)
|
| 340 |
+
self.edit_margin_min('leftcb', margin['leftcb'], ss.colspan.start)
|
| 341 |
+
self.edit_margin_min('right', margin['right'], ss.colspan.stop - 1)
|
| 342 |
+
self.edit_margin_min('rightcb', margin['rightcb'], ss.colspan.stop - 1)
|
| 343 |
+
# rows are from the top down:
|
| 344 |
+
self.edit_margin_min('top', margin['top'], ss.rowspan.start)
|
| 345 |
+
self.edit_margin_min('topcb', margin['topcb'], ss.rowspan.start)
|
| 346 |
+
self.edit_margin_min('bottom', margin['bottom'], ss.rowspan.stop - 1)
|
| 347 |
+
self.edit_margin_min('bottomcb', margin['bottomcb'],
|
| 348 |
+
ss.rowspan.stop - 1)
|
| 349 |
+
|
| 350 |
+
def get_margins(self, todo, col):
|
| 351 |
+
"""Return the margin at this position"""
|
| 352 |
+
return self.margin_vals[todo][col]
|
| 353 |
+
|
| 354 |
+
def get_outer_bbox(self, rows=0, cols=0):
|
| 355 |
+
"""
|
| 356 |
+
Return the outer bounding box of the subplot specs
|
| 357 |
+
given by rows and cols. rows and cols can be spans.
|
| 358 |
+
"""
|
| 359 |
+
rows = np.atleast_1d(rows)
|
| 360 |
+
cols = np.atleast_1d(cols)
|
| 361 |
+
|
| 362 |
+
bbox = Bbox.from_extents(
|
| 363 |
+
self.lefts[cols[0]].value(),
|
| 364 |
+
self.bottoms[rows[-1]].value(),
|
| 365 |
+
self.rights[cols[-1]].value(),
|
| 366 |
+
self.tops[rows[0]].value())
|
| 367 |
+
return bbox
|
| 368 |
+
|
| 369 |
+
def get_inner_bbox(self, rows=0, cols=0):
|
| 370 |
+
"""
|
| 371 |
+
Return the inner bounding box of the subplot specs
|
| 372 |
+
given by rows and cols. rows and cols can be spans.
|
| 373 |
+
"""
|
| 374 |
+
rows = np.atleast_1d(rows)
|
| 375 |
+
cols = np.atleast_1d(cols)
|
| 376 |
+
|
| 377 |
+
bbox = Bbox.from_extents(
|
| 378 |
+
(self.lefts[cols[0]].value() +
|
| 379 |
+
self.margins['left'][cols[0]].value() +
|
| 380 |
+
self.margins['leftcb'][cols[0]].value()),
|
| 381 |
+
(self.bottoms[rows[-1]].value() +
|
| 382 |
+
self.margins['bottom'][rows[-1]].value() +
|
| 383 |
+
self.margins['bottomcb'][rows[-1]].value()),
|
| 384 |
+
(self.rights[cols[-1]].value() -
|
| 385 |
+
self.margins['right'][cols[-1]].value() -
|
| 386 |
+
self.margins['rightcb'][cols[-1]].value()),
|
| 387 |
+
(self.tops[rows[0]].value() -
|
| 388 |
+
self.margins['top'][rows[0]].value() -
|
| 389 |
+
self.margins['topcb'][rows[0]].value())
|
| 390 |
+
)
|
| 391 |
+
return bbox
|
| 392 |
+
|
| 393 |
+
def get_bbox_for_cb(self, rows=0, cols=0):
|
| 394 |
+
"""
|
| 395 |
+
Return the bounding box that includes the
|
| 396 |
+
decorations but, *not* the colorbar...
|
| 397 |
+
"""
|
| 398 |
+
rows = np.atleast_1d(rows)
|
| 399 |
+
cols = np.atleast_1d(cols)
|
| 400 |
+
|
| 401 |
+
bbox = Bbox.from_extents(
|
| 402 |
+
(self.lefts[cols[0]].value() +
|
| 403 |
+
self.margins['leftcb'][cols[0]].value()),
|
| 404 |
+
(self.bottoms[rows[-1]].value() +
|
| 405 |
+
self.margins['bottomcb'][rows[-1]].value()),
|
| 406 |
+
(self.rights[cols[-1]].value() -
|
| 407 |
+
self.margins['rightcb'][cols[-1]].value()),
|
| 408 |
+
(self.tops[rows[0]].value() -
|
| 409 |
+
self.margins['topcb'][rows[0]].value())
|
| 410 |
+
)
|
| 411 |
+
return bbox
|
| 412 |
+
|
| 413 |
+
def get_left_margin_bbox(self, rows=0, cols=0):
|
| 414 |
+
"""
|
| 415 |
+
Return the left margin bounding box of the subplot specs
|
| 416 |
+
given by rows and cols. rows and cols can be spans.
|
| 417 |
+
"""
|
| 418 |
+
rows = np.atleast_1d(rows)
|
| 419 |
+
cols = np.atleast_1d(cols)
|
| 420 |
+
|
| 421 |
+
bbox = Bbox.from_extents(
|
| 422 |
+
(self.lefts[cols[0]].value() +
|
| 423 |
+
self.margins['leftcb'][cols[0]].value()),
|
| 424 |
+
(self.bottoms[rows[-1]].value()),
|
| 425 |
+
(self.lefts[cols[0]].value() +
|
| 426 |
+
self.margins['leftcb'][cols[0]].value() +
|
| 427 |
+
self.margins['left'][cols[0]].value()),
|
| 428 |
+
(self.tops[rows[0]].value()))
|
| 429 |
+
return bbox
|
| 430 |
+
|
| 431 |
+
def get_bottom_margin_bbox(self, rows=0, cols=0):
|
| 432 |
+
"""
|
| 433 |
+
Return the left margin bounding box of the subplot specs
|
| 434 |
+
given by rows and cols. rows and cols can be spans.
|
| 435 |
+
"""
|
| 436 |
+
rows = np.atleast_1d(rows)
|
| 437 |
+
cols = np.atleast_1d(cols)
|
| 438 |
+
|
| 439 |
+
bbox = Bbox.from_extents(
|
| 440 |
+
(self.lefts[cols[0]].value()),
|
| 441 |
+
(self.bottoms[rows[-1]].value() +
|
| 442 |
+
self.margins['bottomcb'][rows[-1]].value()),
|
| 443 |
+
(self.rights[cols[-1]].value()),
|
| 444 |
+
(self.bottoms[rows[-1]].value() +
|
| 445 |
+
self.margins['bottom'][rows[-1]].value() +
|
| 446 |
+
self.margins['bottomcb'][rows[-1]].value()
|
| 447 |
+
))
|
| 448 |
+
return bbox
|
| 449 |
+
|
| 450 |
+
def get_right_margin_bbox(self, rows=0, cols=0):
|
| 451 |
+
"""
|
| 452 |
+
Return the left margin bounding box of the subplot specs
|
| 453 |
+
given by rows and cols. rows and cols can be spans.
|
| 454 |
+
"""
|
| 455 |
+
rows = np.atleast_1d(rows)
|
| 456 |
+
cols = np.atleast_1d(cols)
|
| 457 |
+
|
| 458 |
+
bbox = Bbox.from_extents(
|
| 459 |
+
(self.rights[cols[-1]].value() -
|
| 460 |
+
self.margins['right'][cols[-1]].value() -
|
| 461 |
+
self.margins['rightcb'][cols[-1]].value()),
|
| 462 |
+
(self.bottoms[rows[-1]].value()),
|
| 463 |
+
(self.rights[cols[-1]].value() -
|
| 464 |
+
self.margins['rightcb'][cols[-1]].value()),
|
| 465 |
+
(self.tops[rows[0]].value()))
|
| 466 |
+
return bbox
|
| 467 |
+
|
| 468 |
+
def get_top_margin_bbox(self, rows=0, cols=0):
|
| 469 |
+
"""
|
| 470 |
+
Return the left margin bounding box of the subplot specs
|
| 471 |
+
given by rows and cols. rows and cols can be spans.
|
| 472 |
+
"""
|
| 473 |
+
rows = np.atleast_1d(rows)
|
| 474 |
+
cols = np.atleast_1d(cols)
|
| 475 |
+
|
| 476 |
+
bbox = Bbox.from_extents(
|
| 477 |
+
(self.lefts[cols[0]].value()),
|
| 478 |
+
(self.tops[rows[0]].value() -
|
| 479 |
+
self.margins['topcb'][rows[0]].value()),
|
| 480 |
+
(self.rights[cols[-1]].value()),
|
| 481 |
+
(self.tops[rows[0]].value() -
|
| 482 |
+
self.margins['topcb'][rows[0]].value() -
|
| 483 |
+
self.margins['top'][rows[0]].value()))
|
| 484 |
+
return bbox
|
| 485 |
+
|
| 486 |
+
def update_variables(self):
|
| 487 |
+
"""
|
| 488 |
+
Update the variables for the solver attached to this layoutgrid.
|
| 489 |
+
"""
|
| 490 |
+
self.solver.updateVariables()
|
| 491 |
+
|
| 492 |
+
_layoutboxobjnum = itertools.count()
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
def seq_id():
|
| 496 |
+
"""Generate a short sequential id for layoutbox objects."""
|
| 497 |
+
return '%06d' % next(_layoutboxobjnum)
|
| 498 |
+
|
| 499 |
+
|
| 500 |
+
def plot_children(fig, lg=None, level=0):
|
| 501 |
+
"""Simple plotting to show where boxes are."""
|
| 502 |
+
if lg is None:
|
| 503 |
+
_layoutgrids = fig.get_layout_engine().execute(fig)
|
| 504 |
+
lg = _layoutgrids[fig]
|
| 505 |
+
colors = mpl.rcParams["axes.prop_cycle"].by_key()["color"]
|
| 506 |
+
col = colors[level]
|
| 507 |
+
for i in range(lg.nrows):
|
| 508 |
+
for j in range(lg.ncols):
|
| 509 |
+
bb = lg.get_outer_bbox(rows=i, cols=j)
|
| 510 |
+
fig.add_artist(
|
| 511 |
+
mpatches.Rectangle(bb.p0, bb.width, bb.height, linewidth=1,
|
| 512 |
+
edgecolor='0.7', facecolor='0.7',
|
| 513 |
+
alpha=0.2, transform=fig.transFigure,
|
| 514 |
+
zorder=-3))
|
| 515 |
+
bbi = lg.get_inner_bbox(rows=i, cols=j)
|
| 516 |
+
fig.add_artist(
|
| 517 |
+
mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=2,
|
| 518 |
+
edgecolor=col, facecolor='none',
|
| 519 |
+
transform=fig.transFigure, zorder=-2))
|
| 520 |
+
|
| 521 |
+
bbi = lg.get_left_margin_bbox(rows=i, cols=j)
|
| 522 |
+
fig.add_artist(
|
| 523 |
+
mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
|
| 524 |
+
edgecolor='none', alpha=0.2,
|
| 525 |
+
facecolor=[0.5, 0.7, 0.5],
|
| 526 |
+
transform=fig.transFigure, zorder=-2))
|
| 527 |
+
bbi = lg.get_right_margin_bbox(rows=i, cols=j)
|
| 528 |
+
fig.add_artist(
|
| 529 |
+
mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
|
| 530 |
+
edgecolor='none', alpha=0.2,
|
| 531 |
+
facecolor=[0.7, 0.5, 0.5],
|
| 532 |
+
transform=fig.transFigure, zorder=-2))
|
| 533 |
+
bbi = lg.get_bottom_margin_bbox(rows=i, cols=j)
|
| 534 |
+
fig.add_artist(
|
| 535 |
+
mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
|
| 536 |
+
edgecolor='none', alpha=0.2,
|
| 537 |
+
facecolor=[0.5, 0.5, 0.7],
|
| 538 |
+
transform=fig.transFigure, zorder=-2))
|
| 539 |
+
bbi = lg.get_top_margin_bbox(rows=i, cols=j)
|
| 540 |
+
fig.add_artist(
|
| 541 |
+
mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
|
| 542 |
+
edgecolor='none', alpha=0.2,
|
| 543 |
+
facecolor=[0.7, 0.2, 0.7],
|
| 544 |
+
transform=fig.transFigure, zorder=-2))
|
| 545 |
+
for ch in lg.children.flat:
|
| 546 |
+
if ch is not None:
|
| 547 |
+
plot_children(fig, ch, level=level+1)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_mathtext.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_mathtext_data.py
ADDED
|
@@ -0,0 +1,1742 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
font data tables for truetype and afm computer modern fonts
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
from typing import overload
|
| 7 |
+
|
| 8 |
+
latex_to_bakoma = {
|
| 9 |
+
'\\__sqrt__' : ('cmex10', 0x70),
|
| 10 |
+
'\\bigcap' : ('cmex10', 0x5c),
|
| 11 |
+
'\\bigcup' : ('cmex10', 0x5b),
|
| 12 |
+
'\\bigodot' : ('cmex10', 0x4b),
|
| 13 |
+
'\\bigoplus' : ('cmex10', 0x4d),
|
| 14 |
+
'\\bigotimes' : ('cmex10', 0x4f),
|
| 15 |
+
'\\biguplus' : ('cmex10', 0x5d),
|
| 16 |
+
'\\bigvee' : ('cmex10', 0x5f),
|
| 17 |
+
'\\bigwedge' : ('cmex10', 0x5e),
|
| 18 |
+
'\\coprod' : ('cmex10', 0x61),
|
| 19 |
+
'\\int' : ('cmex10', 0x5a),
|
| 20 |
+
'\\langle' : ('cmex10', 0xad),
|
| 21 |
+
'\\leftangle' : ('cmex10', 0xad),
|
| 22 |
+
'\\leftbrace' : ('cmex10', 0xa9),
|
| 23 |
+
'\\oint' : ('cmex10', 0x49),
|
| 24 |
+
'\\prod' : ('cmex10', 0x59),
|
| 25 |
+
'\\rangle' : ('cmex10', 0xae),
|
| 26 |
+
'\\rightangle' : ('cmex10', 0xae),
|
| 27 |
+
'\\rightbrace' : ('cmex10', 0xaa),
|
| 28 |
+
'\\sum' : ('cmex10', 0x58),
|
| 29 |
+
'\\widehat' : ('cmex10', 0x62),
|
| 30 |
+
'\\widetilde' : ('cmex10', 0x65),
|
| 31 |
+
'\\{' : ('cmex10', 0xa9),
|
| 32 |
+
'\\}' : ('cmex10', 0xaa),
|
| 33 |
+
'{' : ('cmex10', 0xa9),
|
| 34 |
+
'}' : ('cmex10', 0xaa),
|
| 35 |
+
|
| 36 |
+
',' : ('cmmi10', 0x3b),
|
| 37 |
+
'.' : ('cmmi10', 0x3a),
|
| 38 |
+
'/' : ('cmmi10', 0x3d),
|
| 39 |
+
'<' : ('cmmi10', 0x3c),
|
| 40 |
+
'>' : ('cmmi10', 0x3e),
|
| 41 |
+
'\\alpha' : ('cmmi10', 0xae),
|
| 42 |
+
'\\beta' : ('cmmi10', 0xaf),
|
| 43 |
+
'\\chi' : ('cmmi10', 0xc2),
|
| 44 |
+
'\\combiningrightarrowabove' : ('cmmi10', 0x7e),
|
| 45 |
+
'\\delta' : ('cmmi10', 0xb1),
|
| 46 |
+
'\\ell' : ('cmmi10', 0x60),
|
| 47 |
+
'\\epsilon' : ('cmmi10', 0xb2),
|
| 48 |
+
'\\eta' : ('cmmi10', 0xb4),
|
| 49 |
+
'\\flat' : ('cmmi10', 0x5b),
|
| 50 |
+
'\\frown' : ('cmmi10', 0x5f),
|
| 51 |
+
'\\gamma' : ('cmmi10', 0xb0),
|
| 52 |
+
'\\imath' : ('cmmi10', 0x7b),
|
| 53 |
+
'\\iota' : ('cmmi10', 0xb6),
|
| 54 |
+
'\\jmath' : ('cmmi10', 0x7c),
|
| 55 |
+
'\\kappa' : ('cmmi10', 0x2219),
|
| 56 |
+
'\\lambda' : ('cmmi10', 0xb8),
|
| 57 |
+
'\\leftharpoondown' : ('cmmi10', 0x29),
|
| 58 |
+
'\\leftharpoonup' : ('cmmi10', 0x28),
|
| 59 |
+
'\\mu' : ('cmmi10', 0xb9),
|
| 60 |
+
'\\natural' : ('cmmi10', 0x5c),
|
| 61 |
+
'\\nu' : ('cmmi10', 0xba),
|
| 62 |
+
'\\omega' : ('cmmi10', 0x21),
|
| 63 |
+
'\\phi' : ('cmmi10', 0xc1),
|
| 64 |
+
'\\pi' : ('cmmi10', 0xbc),
|
| 65 |
+
'\\psi' : ('cmmi10', 0xc3),
|
| 66 |
+
'\\rho' : ('cmmi10', 0xbd),
|
| 67 |
+
'\\rightharpoondown' : ('cmmi10', 0x2b),
|
| 68 |
+
'\\rightharpoonup' : ('cmmi10', 0x2a),
|
| 69 |
+
'\\sharp' : ('cmmi10', 0x5d),
|
| 70 |
+
'\\sigma' : ('cmmi10', 0xbe),
|
| 71 |
+
'\\smile' : ('cmmi10', 0x5e),
|
| 72 |
+
'\\tau' : ('cmmi10', 0xbf),
|
| 73 |
+
'\\theta' : ('cmmi10', 0xb5),
|
| 74 |
+
'\\triangleleft' : ('cmmi10', 0x2f),
|
| 75 |
+
'\\triangleright' : ('cmmi10', 0x2e),
|
| 76 |
+
'\\upsilon' : ('cmmi10', 0xc0),
|
| 77 |
+
'\\varepsilon' : ('cmmi10', 0x22),
|
| 78 |
+
'\\varphi' : ('cmmi10', 0x27),
|
| 79 |
+
'\\varrho' : ('cmmi10', 0x25),
|
| 80 |
+
'\\varsigma' : ('cmmi10', 0x26),
|
| 81 |
+
'\\vartheta' : ('cmmi10', 0x23),
|
| 82 |
+
'\\wp' : ('cmmi10', 0x7d),
|
| 83 |
+
'\\xi' : ('cmmi10', 0xbb),
|
| 84 |
+
'\\zeta' : ('cmmi10', 0xb3),
|
| 85 |
+
|
| 86 |
+
'!' : ('cmr10', 0x21),
|
| 87 |
+
'%' : ('cmr10', 0x25),
|
| 88 |
+
'&' : ('cmr10', 0x26),
|
| 89 |
+
'(' : ('cmr10', 0x28),
|
| 90 |
+
')' : ('cmr10', 0x29),
|
| 91 |
+
'+' : ('cmr10', 0x2b),
|
| 92 |
+
'0' : ('cmr10', 0x30),
|
| 93 |
+
'1' : ('cmr10', 0x31),
|
| 94 |
+
'2' : ('cmr10', 0x32),
|
| 95 |
+
'3' : ('cmr10', 0x33),
|
| 96 |
+
'4' : ('cmr10', 0x34),
|
| 97 |
+
'5' : ('cmr10', 0x35),
|
| 98 |
+
'6' : ('cmr10', 0x36),
|
| 99 |
+
'7' : ('cmr10', 0x37),
|
| 100 |
+
'8' : ('cmr10', 0x38),
|
| 101 |
+
'9' : ('cmr10', 0x39),
|
| 102 |
+
':' : ('cmr10', 0x3a),
|
| 103 |
+
';' : ('cmr10', 0x3b),
|
| 104 |
+
'=' : ('cmr10', 0x3d),
|
| 105 |
+
'?' : ('cmr10', 0x3f),
|
| 106 |
+
'@' : ('cmr10', 0x40),
|
| 107 |
+
'[' : ('cmr10', 0x5b),
|
| 108 |
+
'\\#' : ('cmr10', 0x23),
|
| 109 |
+
'\\$' : ('cmr10', 0x24),
|
| 110 |
+
'\\%' : ('cmr10', 0x25),
|
| 111 |
+
'\\Delta' : ('cmr10', 0xa2),
|
| 112 |
+
'\\Gamma' : ('cmr10', 0xa1),
|
| 113 |
+
'\\Lambda' : ('cmr10', 0xa4),
|
| 114 |
+
'\\Omega' : ('cmr10', 0xad),
|
| 115 |
+
'\\Phi' : ('cmr10', 0xa9),
|
| 116 |
+
'\\Pi' : ('cmr10', 0xa6),
|
| 117 |
+
'\\Psi' : ('cmr10', 0xaa),
|
| 118 |
+
'\\Sigma' : ('cmr10', 0xa7),
|
| 119 |
+
'\\Theta' : ('cmr10', 0xa3),
|
| 120 |
+
'\\Upsilon' : ('cmr10', 0xa8),
|
| 121 |
+
'\\Xi' : ('cmr10', 0xa5),
|
| 122 |
+
'\\circumflexaccent' : ('cmr10', 0x5e),
|
| 123 |
+
'\\combiningacuteaccent' : ('cmr10', 0xb6),
|
| 124 |
+
'\\combiningbreve' : ('cmr10', 0xb8),
|
| 125 |
+
'\\combiningdiaeresis' : ('cmr10', 0xc4),
|
| 126 |
+
'\\combiningdotabove' : ('cmr10', 0x5f),
|
| 127 |
+
'\\combininggraveaccent' : ('cmr10', 0xb5),
|
| 128 |
+
'\\combiningoverline' : ('cmr10', 0xb9),
|
| 129 |
+
'\\combiningtilde' : ('cmr10', 0x7e),
|
| 130 |
+
'\\leftbracket' : ('cmr10', 0x5b),
|
| 131 |
+
'\\leftparen' : ('cmr10', 0x28),
|
| 132 |
+
'\\rightbracket' : ('cmr10', 0x5d),
|
| 133 |
+
'\\rightparen' : ('cmr10', 0x29),
|
| 134 |
+
'\\widebar' : ('cmr10', 0xb9),
|
| 135 |
+
']' : ('cmr10', 0x5d),
|
| 136 |
+
|
| 137 |
+
'*' : ('cmsy10', 0xa4),
|
| 138 |
+
'\N{MINUS SIGN}' : ('cmsy10', 0xa1),
|
| 139 |
+
'\\Downarrow' : ('cmsy10', 0x2b),
|
| 140 |
+
'\\Im' : ('cmsy10', 0x3d),
|
| 141 |
+
'\\Leftarrow' : ('cmsy10', 0x28),
|
| 142 |
+
'\\Leftrightarrow' : ('cmsy10', 0x2c),
|
| 143 |
+
'\\P' : ('cmsy10', 0x7b),
|
| 144 |
+
'\\Re' : ('cmsy10', 0x3c),
|
| 145 |
+
'\\Rightarrow' : ('cmsy10', 0x29),
|
| 146 |
+
'\\S' : ('cmsy10', 0x78),
|
| 147 |
+
'\\Uparrow' : ('cmsy10', 0x2a),
|
| 148 |
+
'\\Updownarrow' : ('cmsy10', 0x6d),
|
| 149 |
+
'\\Vert' : ('cmsy10', 0x6b),
|
| 150 |
+
'\\aleph' : ('cmsy10', 0x40),
|
| 151 |
+
'\\approx' : ('cmsy10', 0xbc),
|
| 152 |
+
'\\ast' : ('cmsy10', 0xa4),
|
| 153 |
+
'\\asymp' : ('cmsy10', 0xb3),
|
| 154 |
+
'\\backslash' : ('cmsy10', 0x6e),
|
| 155 |
+
'\\bigcirc' : ('cmsy10', 0xb0),
|
| 156 |
+
'\\bigtriangledown' : ('cmsy10', 0x35),
|
| 157 |
+
'\\bigtriangleup' : ('cmsy10', 0x34),
|
| 158 |
+
'\\bot' : ('cmsy10', 0x3f),
|
| 159 |
+
'\\bullet' : ('cmsy10', 0xb2),
|
| 160 |
+
'\\cap' : ('cmsy10', 0x5c),
|
| 161 |
+
'\\cdot' : ('cmsy10', 0xa2),
|
| 162 |
+
'\\circ' : ('cmsy10', 0xb1),
|
| 163 |
+
'\\clubsuit' : ('cmsy10', 0x7c),
|
| 164 |
+
'\\cup' : ('cmsy10', 0x5b),
|
| 165 |
+
'\\dag' : ('cmsy10', 0x79),
|
| 166 |
+
'\\dashv' : ('cmsy10', 0x61),
|
| 167 |
+
'\\ddag' : ('cmsy10', 0x7a),
|
| 168 |
+
'\\diamond' : ('cmsy10', 0xa6),
|
| 169 |
+
'\\diamondsuit' : ('cmsy10', 0x7d),
|
| 170 |
+
'\\div' : ('cmsy10', 0xa5),
|
| 171 |
+
'\\downarrow' : ('cmsy10', 0x23),
|
| 172 |
+
'\\emptyset' : ('cmsy10', 0x3b),
|
| 173 |
+
'\\equiv' : ('cmsy10', 0xb4),
|
| 174 |
+
'\\exists' : ('cmsy10', 0x39),
|
| 175 |
+
'\\forall' : ('cmsy10', 0x38),
|
| 176 |
+
'\\geq' : ('cmsy10', 0xb8),
|
| 177 |
+
'\\gg' : ('cmsy10', 0xc0),
|
| 178 |
+
'\\heartsuit' : ('cmsy10', 0x7e),
|
| 179 |
+
'\\in' : ('cmsy10', 0x32),
|
| 180 |
+
'\\infty' : ('cmsy10', 0x31),
|
| 181 |
+
'\\lbrace' : ('cmsy10', 0x66),
|
| 182 |
+
'\\lceil' : ('cmsy10', 0x64),
|
| 183 |
+
'\\leftarrow' : ('cmsy10', 0xc3),
|
| 184 |
+
'\\leftrightarrow' : ('cmsy10', 0x24),
|
| 185 |
+
'\\leq' : ('cmsy10', 0x2219),
|
| 186 |
+
'\\lfloor' : ('cmsy10', 0x62),
|
| 187 |
+
'\\ll' : ('cmsy10', 0xbf),
|
| 188 |
+
'\\mid' : ('cmsy10', 0x6a),
|
| 189 |
+
'\\mp' : ('cmsy10', 0xa8),
|
| 190 |
+
'\\nabla' : ('cmsy10', 0x72),
|
| 191 |
+
'\\nearrow' : ('cmsy10', 0x25),
|
| 192 |
+
'\\neg' : ('cmsy10', 0x3a),
|
| 193 |
+
'\\ni' : ('cmsy10', 0x33),
|
| 194 |
+
'\\nwarrow' : ('cmsy10', 0x2d),
|
| 195 |
+
'\\odot' : ('cmsy10', 0xaf),
|
| 196 |
+
'\\ominus' : ('cmsy10', 0xaa),
|
| 197 |
+
'\\oplus' : ('cmsy10', 0xa9),
|
| 198 |
+
'\\oslash' : ('cmsy10', 0xae),
|
| 199 |
+
'\\otimes' : ('cmsy10', 0xad),
|
| 200 |
+
'\\pm' : ('cmsy10', 0xa7),
|
| 201 |
+
'\\prec' : ('cmsy10', 0xc1),
|
| 202 |
+
'\\preceq' : ('cmsy10', 0xb9),
|
| 203 |
+
'\\prime' : ('cmsy10', 0x30),
|
| 204 |
+
'\\propto' : ('cmsy10', 0x2f),
|
| 205 |
+
'\\rbrace' : ('cmsy10', 0x67),
|
| 206 |
+
'\\rceil' : ('cmsy10', 0x65),
|
| 207 |
+
'\\rfloor' : ('cmsy10', 0x63),
|
| 208 |
+
'\\rightarrow' : ('cmsy10', 0x21),
|
| 209 |
+
'\\searrow' : ('cmsy10', 0x26),
|
| 210 |
+
'\\sim' : ('cmsy10', 0xbb),
|
| 211 |
+
'\\simeq' : ('cmsy10', 0x27),
|
| 212 |
+
'\\slash' : ('cmsy10', 0x36),
|
| 213 |
+
'\\spadesuit' : ('cmsy10', 0xc4),
|
| 214 |
+
'\\sqcap' : ('cmsy10', 0x75),
|
| 215 |
+
'\\sqcup' : ('cmsy10', 0x74),
|
| 216 |
+
'\\sqsubseteq' : ('cmsy10', 0x76),
|
| 217 |
+
'\\sqsupseteq' : ('cmsy10', 0x77),
|
| 218 |
+
'\\subset' : ('cmsy10', 0xbd),
|
| 219 |
+
'\\subseteq' : ('cmsy10', 0xb5),
|
| 220 |
+
'\\succ' : ('cmsy10', 0xc2),
|
| 221 |
+
'\\succeq' : ('cmsy10', 0xba),
|
| 222 |
+
'\\supset' : ('cmsy10', 0xbe),
|
| 223 |
+
'\\supseteq' : ('cmsy10', 0xb6),
|
| 224 |
+
'\\swarrow' : ('cmsy10', 0x2e),
|
| 225 |
+
'\\times' : ('cmsy10', 0xa3),
|
| 226 |
+
'\\to' : ('cmsy10', 0x21),
|
| 227 |
+
'\\top' : ('cmsy10', 0x3e),
|
| 228 |
+
'\\uparrow' : ('cmsy10', 0x22),
|
| 229 |
+
'\\updownarrow' : ('cmsy10', 0x6c),
|
| 230 |
+
'\\uplus' : ('cmsy10', 0x5d),
|
| 231 |
+
'\\vdash' : ('cmsy10', 0x60),
|
| 232 |
+
'\\vee' : ('cmsy10', 0x5f),
|
| 233 |
+
'\\vert' : ('cmsy10', 0x6a),
|
| 234 |
+
'\\wedge' : ('cmsy10', 0x5e),
|
| 235 |
+
'\\wr' : ('cmsy10', 0x6f),
|
| 236 |
+
'\\|' : ('cmsy10', 0x6b),
|
| 237 |
+
'|' : ('cmsy10', 0x6a),
|
| 238 |
+
|
| 239 |
+
'\\_' : ('cmtt10', 0x5f)
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
# Automatically generated.
|
| 243 |
+
|
| 244 |
+
type12uni = {
|
| 245 |
+
'aring' : 229,
|
| 246 |
+
'quotedblright' : 8221,
|
| 247 |
+
'V' : 86,
|
| 248 |
+
'dollar' : 36,
|
| 249 |
+
'four' : 52,
|
| 250 |
+
'Yacute' : 221,
|
| 251 |
+
'P' : 80,
|
| 252 |
+
'underscore' : 95,
|
| 253 |
+
'p' : 112,
|
| 254 |
+
'Otilde' : 213,
|
| 255 |
+
'perthousand' : 8240,
|
| 256 |
+
'zero' : 48,
|
| 257 |
+
'dotlessi' : 305,
|
| 258 |
+
'Scaron' : 352,
|
| 259 |
+
'zcaron' : 382,
|
| 260 |
+
'egrave' : 232,
|
| 261 |
+
'section' : 167,
|
| 262 |
+
'Icircumflex' : 206,
|
| 263 |
+
'ntilde' : 241,
|
| 264 |
+
'ampersand' : 38,
|
| 265 |
+
'dotaccent' : 729,
|
| 266 |
+
'degree' : 176,
|
| 267 |
+
'K' : 75,
|
| 268 |
+
'acircumflex' : 226,
|
| 269 |
+
'Aring' : 197,
|
| 270 |
+
'k' : 107,
|
| 271 |
+
'smalltilde' : 732,
|
| 272 |
+
'Agrave' : 192,
|
| 273 |
+
'divide' : 247,
|
| 274 |
+
'ocircumflex' : 244,
|
| 275 |
+
'asciitilde' : 126,
|
| 276 |
+
'two' : 50,
|
| 277 |
+
'E' : 69,
|
| 278 |
+
'scaron' : 353,
|
| 279 |
+
'F' : 70,
|
| 280 |
+
'bracketleft' : 91,
|
| 281 |
+
'asciicircum' : 94,
|
| 282 |
+
'f' : 102,
|
| 283 |
+
'ordmasculine' : 186,
|
| 284 |
+
'mu' : 181,
|
| 285 |
+
'paragraph' : 182,
|
| 286 |
+
'nine' : 57,
|
| 287 |
+
'v' : 118,
|
| 288 |
+
'guilsinglleft' : 8249,
|
| 289 |
+
'backslash' : 92,
|
| 290 |
+
'six' : 54,
|
| 291 |
+
'A' : 65,
|
| 292 |
+
'icircumflex' : 238,
|
| 293 |
+
'a' : 97,
|
| 294 |
+
'ogonek' : 731,
|
| 295 |
+
'q' : 113,
|
| 296 |
+
'oacute' : 243,
|
| 297 |
+
'ograve' : 242,
|
| 298 |
+
'edieresis' : 235,
|
| 299 |
+
'comma' : 44,
|
| 300 |
+
'otilde' : 245,
|
| 301 |
+
'guillemotright' : 187,
|
| 302 |
+
'ecircumflex' : 234,
|
| 303 |
+
'greater' : 62,
|
| 304 |
+
'uacute' : 250,
|
| 305 |
+
'L' : 76,
|
| 306 |
+
'bullet' : 8226,
|
| 307 |
+
'cedilla' : 184,
|
| 308 |
+
'ydieresis' : 255,
|
| 309 |
+
'l' : 108,
|
| 310 |
+
'logicalnot' : 172,
|
| 311 |
+
'exclamdown' : 161,
|
| 312 |
+
'endash' : 8211,
|
| 313 |
+
'agrave' : 224,
|
| 314 |
+
'Adieresis' : 196,
|
| 315 |
+
'germandbls' : 223,
|
| 316 |
+
'Odieresis' : 214,
|
| 317 |
+
'space' : 32,
|
| 318 |
+
'quoteright' : 8217,
|
| 319 |
+
'ucircumflex' : 251,
|
| 320 |
+
'G' : 71,
|
| 321 |
+
'quoteleft' : 8216,
|
| 322 |
+
'W' : 87,
|
| 323 |
+
'Q' : 81,
|
| 324 |
+
'g' : 103,
|
| 325 |
+
'w' : 119,
|
| 326 |
+
'question' : 63,
|
| 327 |
+
'one' : 49,
|
| 328 |
+
'ring' : 730,
|
| 329 |
+
'figuredash' : 8210,
|
| 330 |
+
'B' : 66,
|
| 331 |
+
'iacute' : 237,
|
| 332 |
+
'Ydieresis' : 376,
|
| 333 |
+
'R' : 82,
|
| 334 |
+
'b' : 98,
|
| 335 |
+
'r' : 114,
|
| 336 |
+
'Ccedilla' : 199,
|
| 337 |
+
'minus' : 8722,
|
| 338 |
+
'Lslash' : 321,
|
| 339 |
+
'Uacute' : 218,
|
| 340 |
+
'yacute' : 253,
|
| 341 |
+
'Ucircumflex' : 219,
|
| 342 |
+
'quotedbl' : 34,
|
| 343 |
+
'onehalf' : 189,
|
| 344 |
+
'Thorn' : 222,
|
| 345 |
+
'M' : 77,
|
| 346 |
+
'eight' : 56,
|
| 347 |
+
'multiply' : 215,
|
| 348 |
+
'grave' : 96,
|
| 349 |
+
'Ocircumflex' : 212,
|
| 350 |
+
'm' : 109,
|
| 351 |
+
'Ugrave' : 217,
|
| 352 |
+
'guilsinglright' : 8250,
|
| 353 |
+
'Ntilde' : 209,
|
| 354 |
+
'questiondown' : 191,
|
| 355 |
+
'Atilde' : 195,
|
| 356 |
+
'ccedilla' : 231,
|
| 357 |
+
'Z' : 90,
|
| 358 |
+
'copyright' : 169,
|
| 359 |
+
'yen' : 165,
|
| 360 |
+
'Eacute' : 201,
|
| 361 |
+
'H' : 72,
|
| 362 |
+
'X' : 88,
|
| 363 |
+
'Idieresis' : 207,
|
| 364 |
+
'bar' : 124,
|
| 365 |
+
'h' : 104,
|
| 366 |
+
'x' : 120,
|
| 367 |
+
'udieresis' : 252,
|
| 368 |
+
'ordfeminine' : 170,
|
| 369 |
+
'braceleft' : 123,
|
| 370 |
+
'macron' : 175,
|
| 371 |
+
'atilde' : 227,
|
| 372 |
+
'Acircumflex' : 194,
|
| 373 |
+
'Oslash' : 216,
|
| 374 |
+
'C' : 67,
|
| 375 |
+
'quotedblleft' : 8220,
|
| 376 |
+
'S' : 83,
|
| 377 |
+
'exclam' : 33,
|
| 378 |
+
'Zcaron' : 381,
|
| 379 |
+
'equal' : 61,
|
| 380 |
+
's' : 115,
|
| 381 |
+
'eth' : 240,
|
| 382 |
+
'Egrave' : 200,
|
| 383 |
+
'hyphen' : 45,
|
| 384 |
+
'period' : 46,
|
| 385 |
+
'igrave' : 236,
|
| 386 |
+
'colon' : 58,
|
| 387 |
+
'Ecircumflex' : 202,
|
| 388 |
+
'trademark' : 8482,
|
| 389 |
+
'Aacute' : 193,
|
| 390 |
+
'cent' : 162,
|
| 391 |
+
'lslash' : 322,
|
| 392 |
+
'c' : 99,
|
| 393 |
+
'N' : 78,
|
| 394 |
+
'breve' : 728,
|
| 395 |
+
'Oacute' : 211,
|
| 396 |
+
'guillemotleft' : 171,
|
| 397 |
+
'n' : 110,
|
| 398 |
+
'idieresis' : 239,
|
| 399 |
+
'braceright' : 125,
|
| 400 |
+
'seven' : 55,
|
| 401 |
+
'brokenbar' : 166,
|
| 402 |
+
'ugrave' : 249,
|
| 403 |
+
'periodcentered' : 183,
|
| 404 |
+
'sterling' : 163,
|
| 405 |
+
'I' : 73,
|
| 406 |
+
'Y' : 89,
|
| 407 |
+
'Eth' : 208,
|
| 408 |
+
'emdash' : 8212,
|
| 409 |
+
'i' : 105,
|
| 410 |
+
'daggerdbl' : 8225,
|
| 411 |
+
'y' : 121,
|
| 412 |
+
'plusminus' : 177,
|
| 413 |
+
'less' : 60,
|
| 414 |
+
'Udieresis' : 220,
|
| 415 |
+
'D' : 68,
|
| 416 |
+
'five' : 53,
|
| 417 |
+
'T' : 84,
|
| 418 |
+
'oslash' : 248,
|
| 419 |
+
'acute' : 180,
|
| 420 |
+
'd' : 100,
|
| 421 |
+
'OE' : 338,
|
| 422 |
+
'Igrave' : 204,
|
| 423 |
+
't' : 116,
|
| 424 |
+
'parenright' : 41,
|
| 425 |
+
'adieresis' : 228,
|
| 426 |
+
'quotesingle' : 39,
|
| 427 |
+
'twodotenleader' : 8229,
|
| 428 |
+
'slash' : 47,
|
| 429 |
+
'ellipsis' : 8230,
|
| 430 |
+
'numbersign' : 35,
|
| 431 |
+
'odieresis' : 246,
|
| 432 |
+
'O' : 79,
|
| 433 |
+
'oe' : 339,
|
| 434 |
+
'o' : 111,
|
| 435 |
+
'Edieresis' : 203,
|
| 436 |
+
'plus' : 43,
|
| 437 |
+
'dagger' : 8224,
|
| 438 |
+
'three' : 51,
|
| 439 |
+
'hungarumlaut' : 733,
|
| 440 |
+
'parenleft' : 40,
|
| 441 |
+
'fraction' : 8260,
|
| 442 |
+
'registered' : 174,
|
| 443 |
+
'J' : 74,
|
| 444 |
+
'dieresis' : 168,
|
| 445 |
+
'Ograve' : 210,
|
| 446 |
+
'j' : 106,
|
| 447 |
+
'z' : 122,
|
| 448 |
+
'ae' : 230,
|
| 449 |
+
'semicolon' : 59,
|
| 450 |
+
'at' : 64,
|
| 451 |
+
'Iacute' : 205,
|
| 452 |
+
'percent' : 37,
|
| 453 |
+
'bracketright' : 93,
|
| 454 |
+
'AE' : 198,
|
| 455 |
+
'asterisk' : 42,
|
| 456 |
+
'aacute' : 225,
|
| 457 |
+
'U' : 85,
|
| 458 |
+
'eacute' : 233,
|
| 459 |
+
'e' : 101,
|
| 460 |
+
'thorn' : 254,
|
| 461 |
+
'u' : 117,
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
uni2type1 = {v: k for k, v in type12uni.items()}
|
| 465 |
+
|
| 466 |
+
# The script below is to sort and format the tex2uni dict
|
| 467 |
+
|
| 468 |
+
## For decimal values: int(hex(v), 16)
|
| 469 |
+
# newtex = {k: hex(v) for k, v in tex2uni.items()}
|
| 470 |
+
# sd = dict(sorted(newtex.items(), key=lambda item: item[0]))
|
| 471 |
+
#
|
| 472 |
+
## For formatting the sorted dictionary with proper spacing
|
| 473 |
+
## the value '24' comes from finding the longest string in
|
| 474 |
+
## the newtex keys with len(max(newtex, key=len))
|
| 475 |
+
# for key in sd:
|
| 476 |
+
# print("{0:24} : {1: <s},".format("'" + key + "'", sd[key]))
|
| 477 |
+
|
| 478 |
+
tex2uni = {
|
| 479 |
+
'#' : 0x23,
|
| 480 |
+
'$' : 0x24,
|
| 481 |
+
'%' : 0x25,
|
| 482 |
+
'AA' : 0xc5,
|
| 483 |
+
'AE' : 0xc6,
|
| 484 |
+
'BbbC' : 0x2102,
|
| 485 |
+
'BbbN' : 0x2115,
|
| 486 |
+
'BbbP' : 0x2119,
|
| 487 |
+
'BbbQ' : 0x211a,
|
| 488 |
+
'BbbR' : 0x211d,
|
| 489 |
+
'BbbZ' : 0x2124,
|
| 490 |
+
'Bumpeq' : 0x224e,
|
| 491 |
+
'Cap' : 0x22d2,
|
| 492 |
+
'Colon' : 0x2237,
|
| 493 |
+
'Cup' : 0x22d3,
|
| 494 |
+
'DH' : 0xd0,
|
| 495 |
+
'Delta' : 0x394,
|
| 496 |
+
'Doteq' : 0x2251,
|
| 497 |
+
'Downarrow' : 0x21d3,
|
| 498 |
+
'Equiv' : 0x2263,
|
| 499 |
+
'Finv' : 0x2132,
|
| 500 |
+
'Game' : 0x2141,
|
| 501 |
+
'Gamma' : 0x393,
|
| 502 |
+
'H' : 0x30b,
|
| 503 |
+
'Im' : 0x2111,
|
| 504 |
+
'Join' : 0x2a1d,
|
| 505 |
+
'L' : 0x141,
|
| 506 |
+
'Lambda' : 0x39b,
|
| 507 |
+
'Ldsh' : 0x21b2,
|
| 508 |
+
'Leftarrow' : 0x21d0,
|
| 509 |
+
'Leftrightarrow' : 0x21d4,
|
| 510 |
+
'Lleftarrow' : 0x21da,
|
| 511 |
+
'Longleftarrow' : 0x27f8,
|
| 512 |
+
'Longleftrightarrow' : 0x27fa,
|
| 513 |
+
'Longrightarrow' : 0x27f9,
|
| 514 |
+
'Lsh' : 0x21b0,
|
| 515 |
+
'Nearrow' : 0x21d7,
|
| 516 |
+
'Nwarrow' : 0x21d6,
|
| 517 |
+
'O' : 0xd8,
|
| 518 |
+
'OE' : 0x152,
|
| 519 |
+
'Omega' : 0x3a9,
|
| 520 |
+
'P' : 0xb6,
|
| 521 |
+
'Phi' : 0x3a6,
|
| 522 |
+
'Pi' : 0x3a0,
|
| 523 |
+
'Psi' : 0x3a8,
|
| 524 |
+
'QED' : 0x220e,
|
| 525 |
+
'Rdsh' : 0x21b3,
|
| 526 |
+
'Re' : 0x211c,
|
| 527 |
+
'Rightarrow' : 0x21d2,
|
| 528 |
+
'Rrightarrow' : 0x21db,
|
| 529 |
+
'Rsh' : 0x21b1,
|
| 530 |
+
'S' : 0xa7,
|
| 531 |
+
'Searrow' : 0x21d8,
|
| 532 |
+
'Sigma' : 0x3a3,
|
| 533 |
+
'Subset' : 0x22d0,
|
| 534 |
+
'Supset' : 0x22d1,
|
| 535 |
+
'Swarrow' : 0x21d9,
|
| 536 |
+
'Theta' : 0x398,
|
| 537 |
+
'Thorn' : 0xde,
|
| 538 |
+
'Uparrow' : 0x21d1,
|
| 539 |
+
'Updownarrow' : 0x21d5,
|
| 540 |
+
'Upsilon' : 0x3a5,
|
| 541 |
+
'Vdash' : 0x22a9,
|
| 542 |
+
'Vert' : 0x2016,
|
| 543 |
+
'Vvdash' : 0x22aa,
|
| 544 |
+
'Xi' : 0x39e,
|
| 545 |
+
'_' : 0x5f,
|
| 546 |
+
'__sqrt__' : 0x221a,
|
| 547 |
+
'aa' : 0xe5,
|
| 548 |
+
'ac' : 0x223e,
|
| 549 |
+
'acute' : 0x301,
|
| 550 |
+
'acwopencirclearrow' : 0x21ba,
|
| 551 |
+
'adots' : 0x22f0,
|
| 552 |
+
'ae' : 0xe6,
|
| 553 |
+
'aleph' : 0x2135,
|
| 554 |
+
'alpha' : 0x3b1,
|
| 555 |
+
'amalg' : 0x2a3f,
|
| 556 |
+
'angle' : 0x2220,
|
| 557 |
+
'approx' : 0x2248,
|
| 558 |
+
'approxeq' : 0x224a,
|
| 559 |
+
'approxident' : 0x224b,
|
| 560 |
+
'arceq' : 0x2258,
|
| 561 |
+
'ast' : 0x2217,
|
| 562 |
+
'asterisk' : 0x2a,
|
| 563 |
+
'asymp' : 0x224d,
|
| 564 |
+
'backcong' : 0x224c,
|
| 565 |
+
'backepsilon' : 0x3f6,
|
| 566 |
+
'backprime' : 0x2035,
|
| 567 |
+
'backsim' : 0x223d,
|
| 568 |
+
'backsimeq' : 0x22cd,
|
| 569 |
+
'backslash' : 0x5c,
|
| 570 |
+
'bagmember' : 0x22ff,
|
| 571 |
+
'bar' : 0x304,
|
| 572 |
+
'barleftarrow' : 0x21e4,
|
| 573 |
+
'barvee' : 0x22bd,
|
| 574 |
+
'barwedge' : 0x22bc,
|
| 575 |
+
'because' : 0x2235,
|
| 576 |
+
'beta' : 0x3b2,
|
| 577 |
+
'beth' : 0x2136,
|
| 578 |
+
'between' : 0x226c,
|
| 579 |
+
'bigcap' : 0x22c2,
|
| 580 |
+
'bigcirc' : 0x25cb,
|
| 581 |
+
'bigcup' : 0x22c3,
|
| 582 |
+
'bigodot' : 0x2a00,
|
| 583 |
+
'bigoplus' : 0x2a01,
|
| 584 |
+
'bigotimes' : 0x2a02,
|
| 585 |
+
'bigsqcup' : 0x2a06,
|
| 586 |
+
'bigstar' : 0x2605,
|
| 587 |
+
'bigtriangledown' : 0x25bd,
|
| 588 |
+
'bigtriangleup' : 0x25b3,
|
| 589 |
+
'biguplus' : 0x2a04,
|
| 590 |
+
'bigvee' : 0x22c1,
|
| 591 |
+
'bigwedge' : 0x22c0,
|
| 592 |
+
'blacksquare' : 0x25a0,
|
| 593 |
+
'blacktriangle' : 0x25b4,
|
| 594 |
+
'blacktriangledown' : 0x25be,
|
| 595 |
+
'blacktriangleleft' : 0x25c0,
|
| 596 |
+
'blacktriangleright' : 0x25b6,
|
| 597 |
+
'bot' : 0x22a5,
|
| 598 |
+
'bowtie' : 0x22c8,
|
| 599 |
+
'boxbar' : 0x25eb,
|
| 600 |
+
'boxdot' : 0x22a1,
|
| 601 |
+
'boxminus' : 0x229f,
|
| 602 |
+
'boxplus' : 0x229e,
|
| 603 |
+
'boxtimes' : 0x22a0,
|
| 604 |
+
'breve' : 0x306,
|
| 605 |
+
'bullet' : 0x2219,
|
| 606 |
+
'bumpeq' : 0x224f,
|
| 607 |
+
'c' : 0x327,
|
| 608 |
+
'candra' : 0x310,
|
| 609 |
+
'cap' : 0x2229,
|
| 610 |
+
'carriagereturn' : 0x21b5,
|
| 611 |
+
'cdot' : 0x22c5,
|
| 612 |
+
'cdotp' : 0xb7,
|
| 613 |
+
'cdots' : 0x22ef,
|
| 614 |
+
'cent' : 0xa2,
|
| 615 |
+
'check' : 0x30c,
|
| 616 |
+
'checkmark' : 0x2713,
|
| 617 |
+
'chi' : 0x3c7,
|
| 618 |
+
'circ' : 0x2218,
|
| 619 |
+
'circeq' : 0x2257,
|
| 620 |
+
'circlearrowleft' : 0x21ba,
|
| 621 |
+
'circlearrowright' : 0x21bb,
|
| 622 |
+
'circledR' : 0xae,
|
| 623 |
+
'circledS' : 0x24c8,
|
| 624 |
+
'circledast' : 0x229b,
|
| 625 |
+
'circledcirc' : 0x229a,
|
| 626 |
+
'circleddash' : 0x229d,
|
| 627 |
+
'circumflexaccent' : 0x302,
|
| 628 |
+
'clubsuit' : 0x2663,
|
| 629 |
+
'clubsuitopen' : 0x2667,
|
| 630 |
+
'colon' : 0x3a,
|
| 631 |
+
'coloneq' : 0x2254,
|
| 632 |
+
'combiningacuteaccent' : 0x301,
|
| 633 |
+
'combiningbreve' : 0x306,
|
| 634 |
+
'combiningdiaeresis' : 0x308,
|
| 635 |
+
'combiningdotabove' : 0x307,
|
| 636 |
+
'combiningfourdotsabove' : 0x20dc,
|
| 637 |
+
'combininggraveaccent' : 0x300,
|
| 638 |
+
'combiningoverline' : 0x304,
|
| 639 |
+
'combiningrightarrowabove' : 0x20d7,
|
| 640 |
+
'combiningthreedotsabove' : 0x20db,
|
| 641 |
+
'combiningtilde' : 0x303,
|
| 642 |
+
'complement' : 0x2201,
|
| 643 |
+
'cong' : 0x2245,
|
| 644 |
+
'coprod' : 0x2210,
|
| 645 |
+
'copyright' : 0xa9,
|
| 646 |
+
'cup' : 0x222a,
|
| 647 |
+
'cupdot' : 0x228d,
|
| 648 |
+
'cupleftarrow' : 0x228c,
|
| 649 |
+
'curlyeqprec' : 0x22de,
|
| 650 |
+
'curlyeqsucc' : 0x22df,
|
| 651 |
+
'curlyvee' : 0x22ce,
|
| 652 |
+
'curlywedge' : 0x22cf,
|
| 653 |
+
'curvearrowleft' : 0x21b6,
|
| 654 |
+
'curvearrowright' : 0x21b7,
|
| 655 |
+
'cwopencirclearrow' : 0x21bb,
|
| 656 |
+
'd' : 0x323,
|
| 657 |
+
'dag' : 0x2020,
|
| 658 |
+
'dagger' : 0x2020,
|
| 659 |
+
'daleth' : 0x2138,
|
| 660 |
+
'danger' : 0x2621,
|
| 661 |
+
'dashleftarrow' : 0x290e,
|
| 662 |
+
'dashrightarrow' : 0x290f,
|
| 663 |
+
'dashv' : 0x22a3,
|
| 664 |
+
'ddag' : 0x2021,
|
| 665 |
+
'ddagger' : 0x2021,
|
| 666 |
+
'ddddot' : 0x20dc,
|
| 667 |
+
'dddot' : 0x20db,
|
| 668 |
+
'ddot' : 0x308,
|
| 669 |
+
'ddots' : 0x22f1,
|
| 670 |
+
'degree' : 0xb0,
|
| 671 |
+
'delta' : 0x3b4,
|
| 672 |
+
'dh' : 0xf0,
|
| 673 |
+
'diamond' : 0x22c4,
|
| 674 |
+
'diamondsuit' : 0x2662,
|
| 675 |
+
'digamma' : 0x3dd,
|
| 676 |
+
'disin' : 0x22f2,
|
| 677 |
+
'div' : 0xf7,
|
| 678 |
+
'divideontimes' : 0x22c7,
|
| 679 |
+
'dot' : 0x307,
|
| 680 |
+
'doteq' : 0x2250,
|
| 681 |
+
'doteqdot' : 0x2251,
|
| 682 |
+
'dotminus' : 0x2238,
|
| 683 |
+
'dotplus' : 0x2214,
|
| 684 |
+
'dots' : 0x2026,
|
| 685 |
+
'dotsminusdots' : 0x223a,
|
| 686 |
+
'doublebarwedge' : 0x2306,
|
| 687 |
+
'downarrow' : 0x2193,
|
| 688 |
+
'downdownarrows' : 0x21ca,
|
| 689 |
+
'downharpoonleft' : 0x21c3,
|
| 690 |
+
'downharpoonright' : 0x21c2,
|
| 691 |
+
'downzigzagarrow' : 0x21af,
|
| 692 |
+
'ell' : 0x2113,
|
| 693 |
+
'emdash' : 0x2014,
|
| 694 |
+
'emptyset' : 0x2205,
|
| 695 |
+
'endash' : 0x2013,
|
| 696 |
+
'epsilon' : 0x3b5,
|
| 697 |
+
'eqcirc' : 0x2256,
|
| 698 |
+
'eqcolon' : 0x2255,
|
| 699 |
+
'eqdef' : 0x225d,
|
| 700 |
+
'eqgtr' : 0x22dd,
|
| 701 |
+
'eqless' : 0x22dc,
|
| 702 |
+
'eqsim' : 0x2242,
|
| 703 |
+
'eqslantgtr' : 0x2a96,
|
| 704 |
+
'eqslantless' : 0x2a95,
|
| 705 |
+
'equal' : 0x3d,
|
| 706 |
+
'equalparallel' : 0x22d5,
|
| 707 |
+
'equiv' : 0x2261,
|
| 708 |
+
'eta' : 0x3b7,
|
| 709 |
+
'eth' : 0xf0,
|
| 710 |
+
'exists' : 0x2203,
|
| 711 |
+
'fallingdotseq' : 0x2252,
|
| 712 |
+
'flat' : 0x266d,
|
| 713 |
+
'forall' : 0x2200,
|
| 714 |
+
'frakC' : 0x212d,
|
| 715 |
+
'frakZ' : 0x2128,
|
| 716 |
+
'frown' : 0x2322,
|
| 717 |
+
'gamma' : 0x3b3,
|
| 718 |
+
'geq' : 0x2265,
|
| 719 |
+
'geqq' : 0x2267,
|
| 720 |
+
'geqslant' : 0x2a7e,
|
| 721 |
+
'gg' : 0x226b,
|
| 722 |
+
'ggg' : 0x22d9,
|
| 723 |
+
'gimel' : 0x2137,
|
| 724 |
+
'gnapprox' : 0x2a8a,
|
| 725 |
+
'gneqq' : 0x2269,
|
| 726 |
+
'gnsim' : 0x22e7,
|
| 727 |
+
'grave' : 0x300,
|
| 728 |
+
'greater' : 0x3e,
|
| 729 |
+
'gtrapprox' : 0x2a86,
|
| 730 |
+
'gtrdot' : 0x22d7,
|
| 731 |
+
'gtreqless' : 0x22db,
|
| 732 |
+
'gtreqqless' : 0x2a8c,
|
| 733 |
+
'gtrless' : 0x2277,
|
| 734 |
+
'gtrsim' : 0x2273,
|
| 735 |
+
'guillemotleft' : 0xab,
|
| 736 |
+
'guillemotright' : 0xbb,
|
| 737 |
+
'guilsinglleft' : 0x2039,
|
| 738 |
+
'guilsinglright' : 0x203a,
|
| 739 |
+
'hat' : 0x302,
|
| 740 |
+
'hbar' : 0x127,
|
| 741 |
+
'heartsuit' : 0x2661,
|
| 742 |
+
'hermitmatrix' : 0x22b9,
|
| 743 |
+
'hookleftarrow' : 0x21a9,
|
| 744 |
+
'hookrightarrow' : 0x21aa,
|
| 745 |
+
'hslash' : 0x210f,
|
| 746 |
+
'i' : 0x131,
|
| 747 |
+
'iiiint' : 0x2a0c,
|
| 748 |
+
'iiint' : 0x222d,
|
| 749 |
+
'iint' : 0x222c,
|
| 750 |
+
'imageof' : 0x22b7,
|
| 751 |
+
'imath' : 0x131,
|
| 752 |
+
'in' : 0x2208,
|
| 753 |
+
'increment' : 0x2206,
|
| 754 |
+
'infty' : 0x221e,
|
| 755 |
+
'int' : 0x222b,
|
| 756 |
+
'intercal' : 0x22ba,
|
| 757 |
+
'invnot' : 0x2310,
|
| 758 |
+
'iota' : 0x3b9,
|
| 759 |
+
'isinE' : 0x22f9,
|
| 760 |
+
'isindot' : 0x22f5,
|
| 761 |
+
'isinobar' : 0x22f7,
|
| 762 |
+
'isins' : 0x22f4,
|
| 763 |
+
'isinvb' : 0x22f8,
|
| 764 |
+
'jmath' : 0x237,
|
| 765 |
+
'k' : 0x328,
|
| 766 |
+
'kappa' : 0x3ba,
|
| 767 |
+
'kernelcontraction' : 0x223b,
|
| 768 |
+
'l' : 0x142,
|
| 769 |
+
'lambda' : 0x3bb,
|
| 770 |
+
'lambdabar' : 0x19b,
|
| 771 |
+
'langle' : 0x27e8,
|
| 772 |
+
'lasp' : 0x2bd,
|
| 773 |
+
'lbrace' : 0x7b,
|
| 774 |
+
'lbrack' : 0x5b,
|
| 775 |
+
'lceil' : 0x2308,
|
| 776 |
+
'ldots' : 0x2026,
|
| 777 |
+
'leadsto' : 0x21dd,
|
| 778 |
+
'leftarrow' : 0x2190,
|
| 779 |
+
'leftarrowtail' : 0x21a2,
|
| 780 |
+
'leftbrace' : 0x7b,
|
| 781 |
+
'leftharpoonaccent' : 0x20d0,
|
| 782 |
+
'leftharpoondown' : 0x21bd,
|
| 783 |
+
'leftharpoonup' : 0x21bc,
|
| 784 |
+
'leftleftarrows' : 0x21c7,
|
| 785 |
+
'leftparen' : 0x28,
|
| 786 |
+
'leftrightarrow' : 0x2194,
|
| 787 |
+
'leftrightarrows' : 0x21c6,
|
| 788 |
+
'leftrightharpoons' : 0x21cb,
|
| 789 |
+
'leftrightsquigarrow' : 0x21ad,
|
| 790 |
+
'leftsquigarrow' : 0x219c,
|
| 791 |
+
'leftthreetimes' : 0x22cb,
|
| 792 |
+
'leq' : 0x2264,
|
| 793 |
+
'leqq' : 0x2266,
|
| 794 |
+
'leqslant' : 0x2a7d,
|
| 795 |
+
'less' : 0x3c,
|
| 796 |
+
'lessapprox' : 0x2a85,
|
| 797 |
+
'lessdot' : 0x22d6,
|
| 798 |
+
'lesseqgtr' : 0x22da,
|
| 799 |
+
'lesseqqgtr' : 0x2a8b,
|
| 800 |
+
'lessgtr' : 0x2276,
|
| 801 |
+
'lesssim' : 0x2272,
|
| 802 |
+
'lfloor' : 0x230a,
|
| 803 |
+
'lgroup' : 0x27ee,
|
| 804 |
+
'lhd' : 0x25c1,
|
| 805 |
+
'll' : 0x226a,
|
| 806 |
+
'llcorner' : 0x231e,
|
| 807 |
+
'lll' : 0x22d8,
|
| 808 |
+
'lnapprox' : 0x2a89,
|
| 809 |
+
'lneqq' : 0x2268,
|
| 810 |
+
'lnsim' : 0x22e6,
|
| 811 |
+
'longleftarrow' : 0x27f5,
|
| 812 |
+
'longleftrightarrow' : 0x27f7,
|
| 813 |
+
'longmapsto' : 0x27fc,
|
| 814 |
+
'longrightarrow' : 0x27f6,
|
| 815 |
+
'looparrowleft' : 0x21ab,
|
| 816 |
+
'looparrowright' : 0x21ac,
|
| 817 |
+
'lq' : 0x2018,
|
| 818 |
+
'lrcorner' : 0x231f,
|
| 819 |
+
'ltimes' : 0x22c9,
|
| 820 |
+
'macron' : 0xaf,
|
| 821 |
+
'maltese' : 0x2720,
|
| 822 |
+
'mapsdown' : 0x21a7,
|
| 823 |
+
'mapsfrom' : 0x21a4,
|
| 824 |
+
'mapsto' : 0x21a6,
|
| 825 |
+
'mapsup' : 0x21a5,
|
| 826 |
+
'measeq' : 0x225e,
|
| 827 |
+
'measuredangle' : 0x2221,
|
| 828 |
+
'measuredrightangle' : 0x22be,
|
| 829 |
+
'merge' : 0x2a55,
|
| 830 |
+
'mho' : 0x2127,
|
| 831 |
+
'mid' : 0x2223,
|
| 832 |
+
'minus' : 0x2212,
|
| 833 |
+
'minuscolon' : 0x2239,
|
| 834 |
+
'models' : 0x22a7,
|
| 835 |
+
'mp' : 0x2213,
|
| 836 |
+
'mu' : 0x3bc,
|
| 837 |
+
'multimap' : 0x22b8,
|
| 838 |
+
'nLeftarrow' : 0x21cd,
|
| 839 |
+
'nLeftrightarrow' : 0x21ce,
|
| 840 |
+
'nRightarrow' : 0x21cf,
|
| 841 |
+
'nVDash' : 0x22af,
|
| 842 |
+
'nVdash' : 0x22ae,
|
| 843 |
+
'nabla' : 0x2207,
|
| 844 |
+
'napprox' : 0x2249,
|
| 845 |
+
'natural' : 0x266e,
|
| 846 |
+
'ncong' : 0x2247,
|
| 847 |
+
'ne' : 0x2260,
|
| 848 |
+
'nearrow' : 0x2197,
|
| 849 |
+
'neg' : 0xac,
|
| 850 |
+
'neq' : 0x2260,
|
| 851 |
+
'nequiv' : 0x2262,
|
| 852 |
+
'nexists' : 0x2204,
|
| 853 |
+
'ngeq' : 0x2271,
|
| 854 |
+
'ngtr' : 0x226f,
|
| 855 |
+
'ngtrless' : 0x2279,
|
| 856 |
+
'ngtrsim' : 0x2275,
|
| 857 |
+
'ni' : 0x220b,
|
| 858 |
+
'niobar' : 0x22fe,
|
| 859 |
+
'nis' : 0x22fc,
|
| 860 |
+
'nisd' : 0x22fa,
|
| 861 |
+
'nleftarrow' : 0x219a,
|
| 862 |
+
'nleftrightarrow' : 0x21ae,
|
| 863 |
+
'nleq' : 0x2270,
|
| 864 |
+
'nless' : 0x226e,
|
| 865 |
+
'nlessgtr' : 0x2278,
|
| 866 |
+
'nlesssim' : 0x2274,
|
| 867 |
+
'nmid' : 0x2224,
|
| 868 |
+
'not' : 0x338,
|
| 869 |
+
'notin' : 0x2209,
|
| 870 |
+
'notsmallowns' : 0x220c,
|
| 871 |
+
'nparallel' : 0x2226,
|
| 872 |
+
'nprec' : 0x2280,
|
| 873 |
+
'npreccurlyeq' : 0x22e0,
|
| 874 |
+
'nrightarrow' : 0x219b,
|
| 875 |
+
'nsim' : 0x2241,
|
| 876 |
+
'nsimeq' : 0x2244,
|
| 877 |
+
'nsqsubseteq' : 0x22e2,
|
| 878 |
+
'nsqsupseteq' : 0x22e3,
|
| 879 |
+
'nsubset' : 0x2284,
|
| 880 |
+
'nsubseteq' : 0x2288,
|
| 881 |
+
'nsucc' : 0x2281,
|
| 882 |
+
'nsucccurlyeq' : 0x22e1,
|
| 883 |
+
'nsupset' : 0x2285,
|
| 884 |
+
'nsupseteq' : 0x2289,
|
| 885 |
+
'ntriangleleft' : 0x22ea,
|
| 886 |
+
'ntrianglelefteq' : 0x22ec,
|
| 887 |
+
'ntriangleright' : 0x22eb,
|
| 888 |
+
'ntrianglerighteq' : 0x22ed,
|
| 889 |
+
'nu' : 0x3bd,
|
| 890 |
+
'nvDash' : 0x22ad,
|
| 891 |
+
'nvdash' : 0x22ac,
|
| 892 |
+
'nwarrow' : 0x2196,
|
| 893 |
+
'o' : 0xf8,
|
| 894 |
+
'obar' : 0x233d,
|
| 895 |
+
'ocirc' : 0x30a,
|
| 896 |
+
'odot' : 0x2299,
|
| 897 |
+
'oe' : 0x153,
|
| 898 |
+
'oequal' : 0x229c,
|
| 899 |
+
'oiiint' : 0x2230,
|
| 900 |
+
'oiint' : 0x222f,
|
| 901 |
+
'oint' : 0x222e,
|
| 902 |
+
'omega' : 0x3c9,
|
| 903 |
+
'ominus' : 0x2296,
|
| 904 |
+
'oplus' : 0x2295,
|
| 905 |
+
'origof' : 0x22b6,
|
| 906 |
+
'oslash' : 0x2298,
|
| 907 |
+
'otimes' : 0x2297,
|
| 908 |
+
'overarc' : 0x311,
|
| 909 |
+
'overleftarrow' : 0x20d6,
|
| 910 |
+
'overleftrightarrow' : 0x20e1,
|
| 911 |
+
'parallel' : 0x2225,
|
| 912 |
+
'partial' : 0x2202,
|
| 913 |
+
'perp' : 0x27c2,
|
| 914 |
+
'perthousand' : 0x2030,
|
| 915 |
+
'phi' : 0x3d5,
|
| 916 |
+
'pi' : 0x3c0,
|
| 917 |
+
'pitchfork' : 0x22d4,
|
| 918 |
+
'plus' : 0x2b,
|
| 919 |
+
'pm' : 0xb1,
|
| 920 |
+
'prec' : 0x227a,
|
| 921 |
+
'precapprox' : 0x2ab7,
|
| 922 |
+
'preccurlyeq' : 0x227c,
|
| 923 |
+
'preceq' : 0x227c,
|
| 924 |
+
'precnapprox' : 0x2ab9,
|
| 925 |
+
'precnsim' : 0x22e8,
|
| 926 |
+
'precsim' : 0x227e,
|
| 927 |
+
'prime' : 0x2032,
|
| 928 |
+
'prod' : 0x220f,
|
| 929 |
+
'propto' : 0x221d,
|
| 930 |
+
'prurel' : 0x22b0,
|
| 931 |
+
'psi' : 0x3c8,
|
| 932 |
+
'quad' : 0x2003,
|
| 933 |
+
'questeq' : 0x225f,
|
| 934 |
+
'rangle' : 0x27e9,
|
| 935 |
+
'rasp' : 0x2bc,
|
| 936 |
+
'ratio' : 0x2236,
|
| 937 |
+
'rbrace' : 0x7d,
|
| 938 |
+
'rbrack' : 0x5d,
|
| 939 |
+
'rceil' : 0x2309,
|
| 940 |
+
'rfloor' : 0x230b,
|
| 941 |
+
'rgroup' : 0x27ef,
|
| 942 |
+
'rhd' : 0x25b7,
|
| 943 |
+
'rho' : 0x3c1,
|
| 944 |
+
'rightModels' : 0x22ab,
|
| 945 |
+
'rightangle' : 0x221f,
|
| 946 |
+
'rightarrow' : 0x2192,
|
| 947 |
+
'rightarrowbar' : 0x21e5,
|
| 948 |
+
'rightarrowtail' : 0x21a3,
|
| 949 |
+
'rightassert' : 0x22a6,
|
| 950 |
+
'rightbrace' : 0x7d,
|
| 951 |
+
'rightharpoonaccent' : 0x20d1,
|
| 952 |
+
'rightharpoondown' : 0x21c1,
|
| 953 |
+
'rightharpoonup' : 0x21c0,
|
| 954 |
+
'rightleftarrows' : 0x21c4,
|
| 955 |
+
'rightleftharpoons' : 0x21cc,
|
| 956 |
+
'rightparen' : 0x29,
|
| 957 |
+
'rightrightarrows' : 0x21c9,
|
| 958 |
+
'rightsquigarrow' : 0x219d,
|
| 959 |
+
'rightthreetimes' : 0x22cc,
|
| 960 |
+
'rightzigzagarrow' : 0x21dd,
|
| 961 |
+
'ring' : 0x2da,
|
| 962 |
+
'risingdotseq' : 0x2253,
|
| 963 |
+
'rq' : 0x2019,
|
| 964 |
+
'rtimes' : 0x22ca,
|
| 965 |
+
'scrB' : 0x212c,
|
| 966 |
+
'scrE' : 0x2130,
|
| 967 |
+
'scrF' : 0x2131,
|
| 968 |
+
'scrH' : 0x210b,
|
| 969 |
+
'scrI' : 0x2110,
|
| 970 |
+
'scrL' : 0x2112,
|
| 971 |
+
'scrM' : 0x2133,
|
| 972 |
+
'scrR' : 0x211b,
|
| 973 |
+
'scre' : 0x212f,
|
| 974 |
+
'scrg' : 0x210a,
|
| 975 |
+
'scro' : 0x2134,
|
| 976 |
+
'scurel' : 0x22b1,
|
| 977 |
+
'searrow' : 0x2198,
|
| 978 |
+
'setminus' : 0x2216,
|
| 979 |
+
'sharp' : 0x266f,
|
| 980 |
+
'sigma' : 0x3c3,
|
| 981 |
+
'sim' : 0x223c,
|
| 982 |
+
'simeq' : 0x2243,
|
| 983 |
+
'simneqq' : 0x2246,
|
| 984 |
+
'sinewave' : 0x223f,
|
| 985 |
+
'slash' : 0x2215,
|
| 986 |
+
'smallin' : 0x220a,
|
| 987 |
+
'smallintclockwise' : 0x2231,
|
| 988 |
+
'smallointctrcclockwise' : 0x2233,
|
| 989 |
+
'smallowns' : 0x220d,
|
| 990 |
+
'smallsetminus' : 0x2216,
|
| 991 |
+
'smallvarointclockwise' : 0x2232,
|
| 992 |
+
'smile' : 0x2323,
|
| 993 |
+
'solbar' : 0x233f,
|
| 994 |
+
'spadesuit' : 0x2660,
|
| 995 |
+
'spadesuitopen' : 0x2664,
|
| 996 |
+
'sphericalangle' : 0x2222,
|
| 997 |
+
'sqcap' : 0x2293,
|
| 998 |
+
'sqcup' : 0x2294,
|
| 999 |
+
'sqsubset' : 0x228f,
|
| 1000 |
+
'sqsubseteq' : 0x2291,
|
| 1001 |
+
'sqsubsetneq' : 0x22e4,
|
| 1002 |
+
'sqsupset' : 0x2290,
|
| 1003 |
+
'sqsupseteq' : 0x2292,
|
| 1004 |
+
'sqsupsetneq' : 0x22e5,
|
| 1005 |
+
'ss' : 0xdf,
|
| 1006 |
+
'star' : 0x22c6,
|
| 1007 |
+
'stareq' : 0x225b,
|
| 1008 |
+
'sterling' : 0xa3,
|
| 1009 |
+
'subset' : 0x2282,
|
| 1010 |
+
'subseteq' : 0x2286,
|
| 1011 |
+
'subseteqq' : 0x2ac5,
|
| 1012 |
+
'subsetneq' : 0x228a,
|
| 1013 |
+
'subsetneqq' : 0x2acb,
|
| 1014 |
+
'succ' : 0x227b,
|
| 1015 |
+
'succapprox' : 0x2ab8,
|
| 1016 |
+
'succcurlyeq' : 0x227d,
|
| 1017 |
+
'succeq' : 0x227d,
|
| 1018 |
+
'succnapprox' : 0x2aba,
|
| 1019 |
+
'succnsim' : 0x22e9,
|
| 1020 |
+
'succsim' : 0x227f,
|
| 1021 |
+
'sum' : 0x2211,
|
| 1022 |
+
'supset' : 0x2283,
|
| 1023 |
+
'supseteq' : 0x2287,
|
| 1024 |
+
'supseteqq' : 0x2ac6,
|
| 1025 |
+
'supsetneq' : 0x228b,
|
| 1026 |
+
'supsetneqq' : 0x2acc,
|
| 1027 |
+
'swarrow' : 0x2199,
|
| 1028 |
+
't' : 0x361,
|
| 1029 |
+
'tau' : 0x3c4,
|
| 1030 |
+
'textasciiacute' : 0xb4,
|
| 1031 |
+
'textasciicircum' : 0x5e,
|
| 1032 |
+
'textasciigrave' : 0x60,
|
| 1033 |
+
'textasciitilde' : 0x7e,
|
| 1034 |
+
'textexclamdown' : 0xa1,
|
| 1035 |
+
'textquestiondown' : 0xbf,
|
| 1036 |
+
'textquotedblleft' : 0x201c,
|
| 1037 |
+
'textquotedblright' : 0x201d,
|
| 1038 |
+
'therefore' : 0x2234,
|
| 1039 |
+
'theta' : 0x3b8,
|
| 1040 |
+
'thickspace' : 0x2005,
|
| 1041 |
+
'thorn' : 0xfe,
|
| 1042 |
+
'tilde' : 0x303,
|
| 1043 |
+
'times' : 0xd7,
|
| 1044 |
+
'to' : 0x2192,
|
| 1045 |
+
'top' : 0x22a4,
|
| 1046 |
+
'triangle' : 0x25b3,
|
| 1047 |
+
'triangledown' : 0x25bf,
|
| 1048 |
+
'triangleeq' : 0x225c,
|
| 1049 |
+
'triangleleft' : 0x25c1,
|
| 1050 |
+
'trianglelefteq' : 0x22b4,
|
| 1051 |
+
'triangleq' : 0x225c,
|
| 1052 |
+
'triangleright' : 0x25b7,
|
| 1053 |
+
'trianglerighteq' : 0x22b5,
|
| 1054 |
+
'turnednot' : 0x2319,
|
| 1055 |
+
'twoheaddownarrow' : 0x21a1,
|
| 1056 |
+
'twoheadleftarrow' : 0x219e,
|
| 1057 |
+
'twoheadrightarrow' : 0x21a0,
|
| 1058 |
+
'twoheaduparrow' : 0x219f,
|
| 1059 |
+
'ulcorner' : 0x231c,
|
| 1060 |
+
'underbar' : 0x331,
|
| 1061 |
+
'unlhd' : 0x22b4,
|
| 1062 |
+
'unrhd' : 0x22b5,
|
| 1063 |
+
'uparrow' : 0x2191,
|
| 1064 |
+
'updownarrow' : 0x2195,
|
| 1065 |
+
'updownarrowbar' : 0x21a8,
|
| 1066 |
+
'updownarrows' : 0x21c5,
|
| 1067 |
+
'upharpoonleft' : 0x21bf,
|
| 1068 |
+
'upharpoonright' : 0x21be,
|
| 1069 |
+
'uplus' : 0x228e,
|
| 1070 |
+
'upsilon' : 0x3c5,
|
| 1071 |
+
'upuparrows' : 0x21c8,
|
| 1072 |
+
'urcorner' : 0x231d,
|
| 1073 |
+
'vDash' : 0x22a8,
|
| 1074 |
+
'varepsilon' : 0x3b5,
|
| 1075 |
+
'varisinobar' : 0x22f6,
|
| 1076 |
+
'varisins' : 0x22f3,
|
| 1077 |
+
'varkappa' : 0x3f0,
|
| 1078 |
+
'varlrtriangle' : 0x22bf,
|
| 1079 |
+
'varniobar' : 0x22fd,
|
| 1080 |
+
'varnis' : 0x22fb,
|
| 1081 |
+
'varnothing' : 0x2205,
|
| 1082 |
+
'varphi' : 0x3c6,
|
| 1083 |
+
'varpi' : 0x3d6,
|
| 1084 |
+
'varpropto' : 0x221d,
|
| 1085 |
+
'varrho' : 0x3f1,
|
| 1086 |
+
'varsigma' : 0x3c2,
|
| 1087 |
+
'vartheta' : 0x3d1,
|
| 1088 |
+
'vartriangle' : 0x25b5,
|
| 1089 |
+
'vartriangleleft' : 0x22b2,
|
| 1090 |
+
'vartriangleright' : 0x22b3,
|
| 1091 |
+
'vdash' : 0x22a2,
|
| 1092 |
+
'vdots' : 0x22ee,
|
| 1093 |
+
'vec' : 0x20d7,
|
| 1094 |
+
'vee' : 0x2228,
|
| 1095 |
+
'veebar' : 0x22bb,
|
| 1096 |
+
'veeeq' : 0x225a,
|
| 1097 |
+
'vert' : 0x7c,
|
| 1098 |
+
'wedge' : 0x2227,
|
| 1099 |
+
'wedgeq' : 0x2259,
|
| 1100 |
+
'widebar' : 0x305,
|
| 1101 |
+
'widehat' : 0x302,
|
| 1102 |
+
'widetilde' : 0x303,
|
| 1103 |
+
'wp' : 0x2118,
|
| 1104 |
+
'wr' : 0x2240,
|
| 1105 |
+
'xi' : 0x3be,
|
| 1106 |
+
'yen' : 0xa5,
|
| 1107 |
+
'zeta' : 0x3b6,
|
| 1108 |
+
'{' : 0x7b,
|
| 1109 |
+
'|' : 0x2016,
|
| 1110 |
+
'}' : 0x7d,
|
| 1111 |
+
}
|
| 1112 |
+
|
| 1113 |
+
# Each element is a 4-tuple of the form:
|
| 1114 |
+
# src_start, src_end, dst_font, dst_start
|
| 1115 |
+
|
| 1116 |
+
_EntryTypeIn = tuple[str, str, str, str | int]
|
| 1117 |
+
_EntryTypeOut = tuple[int, int, str, int]
|
| 1118 |
+
|
| 1119 |
+
_stix_virtual_fonts: dict[str, dict[str, list[_EntryTypeIn]] | list[_EntryTypeIn]] = {
|
| 1120 |
+
'bb': {
|
| 1121 |
+
"rm": [
|
| 1122 |
+
("\N{DIGIT ZERO}",
|
| 1123 |
+
"\N{DIGIT NINE}",
|
| 1124 |
+
"rm",
|
| 1125 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO}"),
|
| 1126 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1127 |
+
"\N{LATIN CAPITAL LETTER B}",
|
| 1128 |
+
"rm",
|
| 1129 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK CAPITAL A}"),
|
| 1130 |
+
("\N{LATIN CAPITAL LETTER C}",
|
| 1131 |
+
"\N{LATIN CAPITAL LETTER C}",
|
| 1132 |
+
"rm",
|
| 1133 |
+
"\N{DOUBLE-STRUCK CAPITAL C}"),
|
| 1134 |
+
("\N{LATIN CAPITAL LETTER D}",
|
| 1135 |
+
"\N{LATIN CAPITAL LETTER G}",
|
| 1136 |
+
"rm",
|
| 1137 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK CAPITAL D}"),
|
| 1138 |
+
("\N{LATIN CAPITAL LETTER H}",
|
| 1139 |
+
"\N{LATIN CAPITAL LETTER H}",
|
| 1140 |
+
"rm",
|
| 1141 |
+
"\N{DOUBLE-STRUCK CAPITAL H}"),
|
| 1142 |
+
("\N{LATIN CAPITAL LETTER I}",
|
| 1143 |
+
"\N{LATIN CAPITAL LETTER M}",
|
| 1144 |
+
"rm",
|
| 1145 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK CAPITAL I}"),
|
| 1146 |
+
("\N{LATIN CAPITAL LETTER N}",
|
| 1147 |
+
"\N{LATIN CAPITAL LETTER N}",
|
| 1148 |
+
"rm",
|
| 1149 |
+
"\N{DOUBLE-STRUCK CAPITAL N}"),
|
| 1150 |
+
("\N{LATIN CAPITAL LETTER O}",
|
| 1151 |
+
"\N{LATIN CAPITAL LETTER O}",
|
| 1152 |
+
"rm",
|
| 1153 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK CAPITAL O}"),
|
| 1154 |
+
("\N{LATIN CAPITAL LETTER P}",
|
| 1155 |
+
"\N{LATIN CAPITAL LETTER Q}",
|
| 1156 |
+
"rm",
|
| 1157 |
+
"\N{DOUBLE-STRUCK CAPITAL P}"),
|
| 1158 |
+
("\N{LATIN CAPITAL LETTER R}",
|
| 1159 |
+
"\N{LATIN CAPITAL LETTER R}",
|
| 1160 |
+
"rm",
|
| 1161 |
+
"\N{DOUBLE-STRUCK CAPITAL R}"),
|
| 1162 |
+
("\N{LATIN CAPITAL LETTER S}",
|
| 1163 |
+
"\N{LATIN CAPITAL LETTER Y}",
|
| 1164 |
+
"rm",
|
| 1165 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK CAPITAL S}"),
|
| 1166 |
+
("\N{LATIN CAPITAL LETTER Z}",
|
| 1167 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1168 |
+
"rm",
|
| 1169 |
+
"\N{DOUBLE-STRUCK CAPITAL Z}"),
|
| 1170 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1171 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1172 |
+
"rm",
|
| 1173 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK SMALL A}"),
|
| 1174 |
+
("\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1175 |
+
"\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1176 |
+
"rm",
|
| 1177 |
+
"\N{DOUBLE-STRUCK CAPITAL GAMMA}"),
|
| 1178 |
+
("\N{GREEK CAPITAL LETTER PI}",
|
| 1179 |
+
"\N{GREEK CAPITAL LETTER PI}",
|
| 1180 |
+
"rm",
|
| 1181 |
+
"\N{DOUBLE-STRUCK CAPITAL PI}"),
|
| 1182 |
+
("\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1183 |
+
"\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1184 |
+
"rm",
|
| 1185 |
+
"\N{DOUBLE-STRUCK N-ARY SUMMATION}"),
|
| 1186 |
+
("\N{GREEK SMALL LETTER GAMMA}",
|
| 1187 |
+
"\N{GREEK SMALL LETTER GAMMA}",
|
| 1188 |
+
"rm",
|
| 1189 |
+
"\N{DOUBLE-STRUCK SMALL GAMMA}"),
|
| 1190 |
+
("\N{GREEK SMALL LETTER PI}",
|
| 1191 |
+
"\N{GREEK SMALL LETTER PI}",
|
| 1192 |
+
"rm",
|
| 1193 |
+
"\N{DOUBLE-STRUCK SMALL PI}"),
|
| 1194 |
+
],
|
| 1195 |
+
"it": [
|
| 1196 |
+
("\N{DIGIT ZERO}",
|
| 1197 |
+
"\N{DIGIT NINE}",
|
| 1198 |
+
"rm",
|
| 1199 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO}"),
|
| 1200 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1201 |
+
"\N{LATIN CAPITAL LETTER B}",
|
| 1202 |
+
"it",
|
| 1203 |
+
0xe154),
|
| 1204 |
+
("\N{LATIN CAPITAL LETTER C}",
|
| 1205 |
+
"\N{LATIN CAPITAL LETTER C}",
|
| 1206 |
+
"it",
|
| 1207 |
+
"\N{DOUBLE-STRUCK CAPITAL C}"),
|
| 1208 |
+
("\N{LATIN CAPITAL LETTER D}",
|
| 1209 |
+
"\N{LATIN CAPITAL LETTER D}",
|
| 1210 |
+
"it",
|
| 1211 |
+
"\N{DOUBLE-STRUCK ITALIC CAPITAL D}"),
|
| 1212 |
+
("\N{LATIN CAPITAL LETTER E}",
|
| 1213 |
+
"\N{LATIN CAPITAL LETTER G}",
|
| 1214 |
+
"it",
|
| 1215 |
+
0xe156),
|
| 1216 |
+
("\N{LATIN CAPITAL LETTER H}",
|
| 1217 |
+
"\N{LATIN CAPITAL LETTER H}",
|
| 1218 |
+
"it",
|
| 1219 |
+
"\N{DOUBLE-STRUCK CAPITAL H}"),
|
| 1220 |
+
("\N{LATIN CAPITAL LETTER I}",
|
| 1221 |
+
"\N{LATIN CAPITAL LETTER M}",
|
| 1222 |
+
"it",
|
| 1223 |
+
0xe159),
|
| 1224 |
+
("\N{LATIN CAPITAL LETTER N}",
|
| 1225 |
+
"\N{LATIN CAPITAL LETTER N}",
|
| 1226 |
+
"it",
|
| 1227 |
+
"\N{DOUBLE-STRUCK CAPITAL N}"),
|
| 1228 |
+
("\N{LATIN CAPITAL LETTER O}",
|
| 1229 |
+
"\N{LATIN CAPITAL LETTER O}",
|
| 1230 |
+
"it",
|
| 1231 |
+
0xe15e),
|
| 1232 |
+
("\N{LATIN CAPITAL LETTER P}",
|
| 1233 |
+
"\N{LATIN CAPITAL LETTER Q}",
|
| 1234 |
+
"it",
|
| 1235 |
+
"\N{DOUBLE-STRUCK CAPITAL P}"),
|
| 1236 |
+
("\N{LATIN CAPITAL LETTER R}",
|
| 1237 |
+
"\N{LATIN CAPITAL LETTER R}",
|
| 1238 |
+
"it",
|
| 1239 |
+
"\N{DOUBLE-STRUCK CAPITAL R}"),
|
| 1240 |
+
("\N{LATIN CAPITAL LETTER S}",
|
| 1241 |
+
"\N{LATIN CAPITAL LETTER Y}",
|
| 1242 |
+
"it",
|
| 1243 |
+
0xe15f),
|
| 1244 |
+
("\N{LATIN CAPITAL LETTER Z}",
|
| 1245 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1246 |
+
"it",
|
| 1247 |
+
"\N{DOUBLE-STRUCK CAPITAL Z}"),
|
| 1248 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1249 |
+
"\N{LATIN SMALL LETTER C}",
|
| 1250 |
+
"it",
|
| 1251 |
+
0xe166),
|
| 1252 |
+
("\N{LATIN SMALL LETTER D}",
|
| 1253 |
+
"\N{LATIN SMALL LETTER E}",
|
| 1254 |
+
"it",
|
| 1255 |
+
"\N{DOUBLE-STRUCK ITALIC SMALL D}"),
|
| 1256 |
+
("\N{LATIN SMALL LETTER F}",
|
| 1257 |
+
"\N{LATIN SMALL LETTER H}",
|
| 1258 |
+
"it",
|
| 1259 |
+
0xe169),
|
| 1260 |
+
("\N{LATIN SMALL LETTER I}",
|
| 1261 |
+
"\N{LATIN SMALL LETTER J}",
|
| 1262 |
+
"it",
|
| 1263 |
+
"\N{DOUBLE-STRUCK ITALIC SMALL I}"),
|
| 1264 |
+
("\N{LATIN SMALL LETTER K}",
|
| 1265 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1266 |
+
"it",
|
| 1267 |
+
0xe16c),
|
| 1268 |
+
("\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1269 |
+
"\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1270 |
+
"it",
|
| 1271 |
+
"\N{DOUBLE-STRUCK CAPITAL GAMMA}"), # \Gamma (not in beta STIX fonts)
|
| 1272 |
+
("\N{GREEK CAPITAL LETTER PI}",
|
| 1273 |
+
"\N{GREEK CAPITAL LETTER PI}",
|
| 1274 |
+
"it",
|
| 1275 |
+
"\N{DOUBLE-STRUCK CAPITAL PI}"),
|
| 1276 |
+
("\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1277 |
+
"\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1278 |
+
"it",
|
| 1279 |
+
"\N{DOUBLE-STRUCK N-ARY SUMMATION}"), # \Sigma (not in beta STIX fonts)
|
| 1280 |
+
("\N{GREEK SMALL LETTER GAMMA}",
|
| 1281 |
+
"\N{GREEK SMALL LETTER GAMMA}",
|
| 1282 |
+
"it",
|
| 1283 |
+
"\N{DOUBLE-STRUCK SMALL GAMMA}"), # \gamma (not in beta STIX fonts)
|
| 1284 |
+
("\N{GREEK SMALL LETTER PI}",
|
| 1285 |
+
"\N{GREEK SMALL LETTER PI}",
|
| 1286 |
+
"it",
|
| 1287 |
+
"\N{DOUBLE-STRUCK SMALL PI}"),
|
| 1288 |
+
],
|
| 1289 |
+
"bf": [
|
| 1290 |
+
("\N{DIGIT ZERO}",
|
| 1291 |
+
"\N{DIGIT NINE}",
|
| 1292 |
+
"rm",
|
| 1293 |
+
"\N{MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO}"),
|
| 1294 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1295 |
+
"\N{LATIN CAPITAL LETTER B}",
|
| 1296 |
+
"bf",
|
| 1297 |
+
0xe38a),
|
| 1298 |
+
("\N{LATIN CAPITAL LETTER C}",
|
| 1299 |
+
"\N{LATIN CAPITAL LETTER C}",
|
| 1300 |
+
"bf",
|
| 1301 |
+
"\N{DOUBLE-STRUCK CAPITAL C}"),
|
| 1302 |
+
("\N{LATIN CAPITAL LETTER D}",
|
| 1303 |
+
"\N{LATIN CAPITAL LETTER D}",
|
| 1304 |
+
"bf",
|
| 1305 |
+
"\N{DOUBLE-STRUCK ITALIC CAPITAL D}"),
|
| 1306 |
+
("\N{LATIN CAPITAL LETTER E}",
|
| 1307 |
+
"\N{LATIN CAPITAL LETTER G}",
|
| 1308 |
+
"bf",
|
| 1309 |
+
0xe38d),
|
| 1310 |
+
("\N{LATIN CAPITAL LETTER H}",
|
| 1311 |
+
"\N{LATIN CAPITAL LETTER H}",
|
| 1312 |
+
"bf",
|
| 1313 |
+
"\N{DOUBLE-STRUCK CAPITAL H}"),
|
| 1314 |
+
("\N{LATIN CAPITAL LETTER I}",
|
| 1315 |
+
"\N{LATIN CAPITAL LETTER M}",
|
| 1316 |
+
"bf",
|
| 1317 |
+
0xe390),
|
| 1318 |
+
("\N{LATIN CAPITAL LETTER N}",
|
| 1319 |
+
"\N{LATIN CAPITAL LETTER N}",
|
| 1320 |
+
"bf",
|
| 1321 |
+
"\N{DOUBLE-STRUCK CAPITAL N}"),
|
| 1322 |
+
("\N{LATIN CAPITAL LETTER O}",
|
| 1323 |
+
"\N{LATIN CAPITAL LETTER O}",
|
| 1324 |
+
"bf",
|
| 1325 |
+
0xe395),
|
| 1326 |
+
("\N{LATIN CAPITAL LETTER P}",
|
| 1327 |
+
"\N{LATIN CAPITAL LETTER Q}",
|
| 1328 |
+
"bf",
|
| 1329 |
+
"\N{DOUBLE-STRUCK CAPITAL P}"),
|
| 1330 |
+
("\N{LATIN CAPITAL LETTER R}",
|
| 1331 |
+
"\N{LATIN CAPITAL LETTER R}",
|
| 1332 |
+
"bf",
|
| 1333 |
+
"\N{DOUBLE-STRUCK CAPITAL R}"),
|
| 1334 |
+
("\N{LATIN CAPITAL LETTER S}",
|
| 1335 |
+
"\N{LATIN CAPITAL LETTER Y}",
|
| 1336 |
+
"bf",
|
| 1337 |
+
0xe396),
|
| 1338 |
+
("\N{LATIN CAPITAL LETTER Z}",
|
| 1339 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1340 |
+
"bf",
|
| 1341 |
+
"\N{DOUBLE-STRUCK CAPITAL Z}"),
|
| 1342 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1343 |
+
"\N{LATIN SMALL LETTER C}",
|
| 1344 |
+
"bf",
|
| 1345 |
+
0xe39d),
|
| 1346 |
+
("\N{LATIN SMALL LETTER D}",
|
| 1347 |
+
"\N{LATIN SMALL LETTER E}",
|
| 1348 |
+
"bf",
|
| 1349 |
+
"\N{DOUBLE-STRUCK ITALIC SMALL D}"),
|
| 1350 |
+
("\N{LATIN SMALL LETTER F}",
|
| 1351 |
+
"\N{LATIN SMALL LETTER H}",
|
| 1352 |
+
"bf",
|
| 1353 |
+
0xe3a2),
|
| 1354 |
+
("\N{LATIN SMALL LETTER I}",
|
| 1355 |
+
"\N{LATIN SMALL LETTER J}",
|
| 1356 |
+
"bf",
|
| 1357 |
+
"\N{DOUBLE-STRUCK ITALIC SMALL I}"),
|
| 1358 |
+
("\N{LATIN SMALL LETTER K}",
|
| 1359 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1360 |
+
"bf",
|
| 1361 |
+
0xe3a7),
|
| 1362 |
+
("\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1363 |
+
"\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1364 |
+
"bf",
|
| 1365 |
+
"\N{DOUBLE-STRUCK CAPITAL GAMMA}"),
|
| 1366 |
+
("\N{GREEK CAPITAL LETTER PI}",
|
| 1367 |
+
"\N{GREEK CAPITAL LETTER PI}",
|
| 1368 |
+
"bf",
|
| 1369 |
+
"\N{DOUBLE-STRUCK CAPITAL PI}"),
|
| 1370 |
+
("\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1371 |
+
"\N{GREEK CAPITAL LETTER SIGMA}",
|
| 1372 |
+
"bf",
|
| 1373 |
+
"\N{DOUBLE-STRUCK N-ARY SUMMATION}"),
|
| 1374 |
+
("\N{GREEK SMALL LETTER GAMMA}",
|
| 1375 |
+
"\N{GREEK SMALL LETTER GAMMA}",
|
| 1376 |
+
"bf",
|
| 1377 |
+
"\N{DOUBLE-STRUCK SMALL GAMMA}"),
|
| 1378 |
+
("\N{GREEK SMALL LETTER PI}",
|
| 1379 |
+
"\N{GREEK SMALL LETTER PI}",
|
| 1380 |
+
"bf",
|
| 1381 |
+
"\N{DOUBLE-STRUCK SMALL PI}"),
|
| 1382 |
+
],
|
| 1383 |
+
},
|
| 1384 |
+
'cal': [
|
| 1385 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1386 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1387 |
+
"it",
|
| 1388 |
+
0xe22d),
|
| 1389 |
+
],
|
| 1390 |
+
'frak': {
|
| 1391 |
+
"rm": [
|
| 1392 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1393 |
+
"\N{LATIN CAPITAL LETTER B}",
|
| 1394 |
+
"rm",
|
| 1395 |
+
"\N{MATHEMATICAL FRAKTUR CAPITAL A}"),
|
| 1396 |
+
("\N{LATIN CAPITAL LETTER C}",
|
| 1397 |
+
"\N{LATIN CAPITAL LETTER C}",
|
| 1398 |
+
"rm",
|
| 1399 |
+
"\N{BLACK-LETTER CAPITAL C}"),
|
| 1400 |
+
("\N{LATIN CAPITAL LETTER D}",
|
| 1401 |
+
"\N{LATIN CAPITAL LETTER G}",
|
| 1402 |
+
"rm",
|
| 1403 |
+
"\N{MATHEMATICAL FRAKTUR CAPITAL D}"),
|
| 1404 |
+
("\N{LATIN CAPITAL LETTER H}",
|
| 1405 |
+
"\N{LATIN CAPITAL LETTER H}",
|
| 1406 |
+
"rm",
|
| 1407 |
+
"\N{BLACK-LETTER CAPITAL H}"),
|
| 1408 |
+
("\N{LATIN CAPITAL LETTER I}",
|
| 1409 |
+
"\N{LATIN CAPITAL LETTER I}",
|
| 1410 |
+
"rm",
|
| 1411 |
+
"\N{BLACK-LETTER CAPITAL I}"),
|
| 1412 |
+
("\N{LATIN CAPITAL LETTER J}",
|
| 1413 |
+
"\N{LATIN CAPITAL LETTER Q}",
|
| 1414 |
+
"rm",
|
| 1415 |
+
"\N{MATHEMATICAL FRAKTUR CAPITAL J}"),
|
| 1416 |
+
("\N{LATIN CAPITAL LETTER R}",
|
| 1417 |
+
"\N{LATIN CAPITAL LETTER R}",
|
| 1418 |
+
"rm",
|
| 1419 |
+
"\N{BLACK-LETTER CAPITAL R}"),
|
| 1420 |
+
("\N{LATIN CAPITAL LETTER S}",
|
| 1421 |
+
"\N{LATIN CAPITAL LETTER Y}",
|
| 1422 |
+
"rm",
|
| 1423 |
+
"\N{MATHEMATICAL FRAKTUR CAPITAL S}"),
|
| 1424 |
+
("\N{LATIN CAPITAL LETTER Z}",
|
| 1425 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1426 |
+
"rm",
|
| 1427 |
+
"\N{BLACK-LETTER CAPITAL Z}"),
|
| 1428 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1429 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1430 |
+
"rm",
|
| 1431 |
+
"\N{MATHEMATICAL FRAKTUR SMALL A}"),
|
| 1432 |
+
],
|
| 1433 |
+
"bf": [
|
| 1434 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1435 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1436 |
+
"bf",
|
| 1437 |
+
"\N{MATHEMATICAL BOLD FRAKTUR CAPITAL A}"),
|
| 1438 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1439 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1440 |
+
"bf",
|
| 1441 |
+
"\N{MATHEMATICAL BOLD FRAKTUR SMALL A}"),
|
| 1442 |
+
],
|
| 1443 |
+
},
|
| 1444 |
+
'scr': [
|
| 1445 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1446 |
+
"\N{LATIN CAPITAL LETTER A}",
|
| 1447 |
+
"it",
|
| 1448 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL A}"),
|
| 1449 |
+
("\N{LATIN CAPITAL LETTER B}",
|
| 1450 |
+
"\N{LATIN CAPITAL LETTER B}",
|
| 1451 |
+
"it",
|
| 1452 |
+
"\N{SCRIPT CAPITAL B}"),
|
| 1453 |
+
("\N{LATIN CAPITAL LETTER C}",
|
| 1454 |
+
"\N{LATIN CAPITAL LETTER D}",
|
| 1455 |
+
"it",
|
| 1456 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL C}"),
|
| 1457 |
+
("\N{LATIN CAPITAL LETTER E}",
|
| 1458 |
+
"\N{LATIN CAPITAL LETTER F}",
|
| 1459 |
+
"it",
|
| 1460 |
+
"\N{SCRIPT CAPITAL E}"),
|
| 1461 |
+
("\N{LATIN CAPITAL LETTER G}",
|
| 1462 |
+
"\N{LATIN CAPITAL LETTER G}",
|
| 1463 |
+
"it",
|
| 1464 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL G}"),
|
| 1465 |
+
("\N{LATIN CAPITAL LETTER H}",
|
| 1466 |
+
"\N{LATIN CAPITAL LETTER H}",
|
| 1467 |
+
"it",
|
| 1468 |
+
"\N{SCRIPT CAPITAL H}"),
|
| 1469 |
+
("\N{LATIN CAPITAL LETTER I}",
|
| 1470 |
+
"\N{LATIN CAPITAL LETTER I}",
|
| 1471 |
+
"it",
|
| 1472 |
+
"\N{SCRIPT CAPITAL I}"),
|
| 1473 |
+
("\N{LATIN CAPITAL LETTER J}",
|
| 1474 |
+
"\N{LATIN CAPITAL LETTER K}",
|
| 1475 |
+
"it",
|
| 1476 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL J}"),
|
| 1477 |
+
("\N{LATIN CAPITAL LETTER L}",
|
| 1478 |
+
"\N{LATIN CAPITAL LETTER L}",
|
| 1479 |
+
"it",
|
| 1480 |
+
"\N{SCRIPT CAPITAL L}"),
|
| 1481 |
+
("\N{LATIN CAPITAL LETTER M}",
|
| 1482 |
+
"\N{LATIN CAPITAL LETTER M}",
|
| 1483 |
+
"it",
|
| 1484 |
+
"\N{SCRIPT CAPITAL M}"),
|
| 1485 |
+
("\N{LATIN CAPITAL LETTER N}",
|
| 1486 |
+
"\N{LATIN CAPITAL LETTER Q}",
|
| 1487 |
+
"it",
|
| 1488 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL N}"),
|
| 1489 |
+
("\N{LATIN CAPITAL LETTER R}",
|
| 1490 |
+
"\N{LATIN CAPITAL LETTER R}",
|
| 1491 |
+
"it",
|
| 1492 |
+
"\N{SCRIPT CAPITAL R}"),
|
| 1493 |
+
("\N{LATIN CAPITAL LETTER S}",
|
| 1494 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1495 |
+
"it",
|
| 1496 |
+
"\N{MATHEMATICAL SCRIPT CAPITAL S}"),
|
| 1497 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1498 |
+
"\N{LATIN SMALL LETTER D}",
|
| 1499 |
+
"it",
|
| 1500 |
+
"\N{MATHEMATICAL SCRIPT SMALL A}"),
|
| 1501 |
+
("\N{LATIN SMALL LETTER E}",
|
| 1502 |
+
"\N{LATIN SMALL LETTER E}",
|
| 1503 |
+
"it",
|
| 1504 |
+
"\N{SCRIPT SMALL E}"),
|
| 1505 |
+
("\N{LATIN SMALL LETTER F}",
|
| 1506 |
+
"\N{LATIN SMALL LETTER F}",
|
| 1507 |
+
"it",
|
| 1508 |
+
"\N{MATHEMATICAL SCRIPT SMALL F}"),
|
| 1509 |
+
("\N{LATIN SMALL LETTER G}",
|
| 1510 |
+
"\N{LATIN SMALL LETTER G}",
|
| 1511 |
+
"it",
|
| 1512 |
+
"\N{SCRIPT SMALL G}"),
|
| 1513 |
+
("\N{LATIN SMALL LETTER H}",
|
| 1514 |
+
"\N{LATIN SMALL LETTER N}",
|
| 1515 |
+
"it",
|
| 1516 |
+
"\N{MATHEMATICAL SCRIPT SMALL H}"),
|
| 1517 |
+
("\N{LATIN SMALL LETTER O}",
|
| 1518 |
+
"\N{LATIN SMALL LETTER O}",
|
| 1519 |
+
"it",
|
| 1520 |
+
"\N{SCRIPT SMALL O}"),
|
| 1521 |
+
("\N{LATIN SMALL LETTER P}",
|
| 1522 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1523 |
+
"it",
|
| 1524 |
+
"\N{MATHEMATICAL SCRIPT SMALL P}"),
|
| 1525 |
+
],
|
| 1526 |
+
'sf': {
|
| 1527 |
+
"rm": [
|
| 1528 |
+
("\N{DIGIT ZERO}",
|
| 1529 |
+
"\N{DIGIT NINE}",
|
| 1530 |
+
"rm",
|
| 1531 |
+
"\N{MATHEMATICAL SANS-SERIF DIGIT ZERO}"),
|
| 1532 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1533 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1534 |
+
"rm",
|
| 1535 |
+
"\N{MATHEMATICAL SANS-SERIF CAPITAL A}"),
|
| 1536 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1537 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1538 |
+
"rm",
|
| 1539 |
+
"\N{MATHEMATICAL SANS-SERIF SMALL A}"),
|
| 1540 |
+
("\N{GREEK CAPITAL LETTER ALPHA}",
|
| 1541 |
+
"\N{GREEK CAPITAL LETTER OMEGA}",
|
| 1542 |
+
"rm",
|
| 1543 |
+
0xe17d),
|
| 1544 |
+
("\N{GREEK SMALL LETTER ALPHA}",
|
| 1545 |
+
"\N{GREEK SMALL LETTER OMEGA}",
|
| 1546 |
+
"rm",
|
| 1547 |
+
0xe196),
|
| 1548 |
+
("\N{GREEK THETA SYMBOL}",
|
| 1549 |
+
"\N{GREEK THETA SYMBOL}",
|
| 1550 |
+
"rm",
|
| 1551 |
+
0xe1b0),
|
| 1552 |
+
("\N{GREEK PHI SYMBOL}",
|
| 1553 |
+
"\N{GREEK PHI SYMBOL}",
|
| 1554 |
+
"rm",
|
| 1555 |
+
0xe1b1),
|
| 1556 |
+
("\N{GREEK PI SYMBOL}",
|
| 1557 |
+
"\N{GREEK PI SYMBOL}",
|
| 1558 |
+
"rm",
|
| 1559 |
+
0xe1b3),
|
| 1560 |
+
("\N{GREEK RHO SYMBOL}",
|
| 1561 |
+
"\N{GREEK RHO SYMBOL}",
|
| 1562 |
+
"rm",
|
| 1563 |
+
0xe1b2),
|
| 1564 |
+
("\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1565 |
+
"\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1566 |
+
"rm",
|
| 1567 |
+
0xe1af),
|
| 1568 |
+
("\N{PARTIAL DIFFERENTIAL}",
|
| 1569 |
+
"\N{PARTIAL DIFFERENTIAL}",
|
| 1570 |
+
"rm",
|
| 1571 |
+
0xe17c),
|
| 1572 |
+
],
|
| 1573 |
+
"it": [
|
| 1574 |
+
# These numerals are actually upright. We don't actually
|
| 1575 |
+
# want italic numerals ever.
|
| 1576 |
+
("\N{DIGIT ZERO}",
|
| 1577 |
+
"\N{DIGIT NINE}",
|
| 1578 |
+
"rm",
|
| 1579 |
+
"\N{MATHEMATICAL SANS-SERIF DIGIT ZERO}"),
|
| 1580 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1581 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1582 |
+
"it",
|
| 1583 |
+
"\N{MATHEMATICAL SANS-SERIF ITALIC CAPITAL A}"),
|
| 1584 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1585 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1586 |
+
"it",
|
| 1587 |
+
"\N{MATHEMATICAL SANS-SERIF ITALIC SMALL A}"),
|
| 1588 |
+
("\N{GREEK CAPITAL LETTER ALPHA}",
|
| 1589 |
+
"\N{GREEK CAPITAL LETTER OMEGA}",
|
| 1590 |
+
"rm",
|
| 1591 |
+
0xe17d),
|
| 1592 |
+
("\N{GREEK SMALL LETTER ALPHA}",
|
| 1593 |
+
"\N{GREEK SMALL LETTER OMEGA}",
|
| 1594 |
+
"it",
|
| 1595 |
+
0xe1d8),
|
| 1596 |
+
("\N{GREEK THETA SYMBOL}",
|
| 1597 |
+
"\N{GREEK THETA SYMBOL}",
|
| 1598 |
+
"it",
|
| 1599 |
+
0xe1f2),
|
| 1600 |
+
("\N{GREEK PHI SYMBOL}",
|
| 1601 |
+
"\N{GREEK PHI SYMBOL}",
|
| 1602 |
+
"it",
|
| 1603 |
+
0xe1f3),
|
| 1604 |
+
("\N{GREEK PI SYMBOL}",
|
| 1605 |
+
"\N{GREEK PI SYMBOL}",
|
| 1606 |
+
"it",
|
| 1607 |
+
0xe1f5),
|
| 1608 |
+
("\N{GREEK RHO SYMBOL}",
|
| 1609 |
+
"\N{GREEK RHO SYMBOL}",
|
| 1610 |
+
"it",
|
| 1611 |
+
0xe1f4),
|
| 1612 |
+
("\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1613 |
+
"\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1614 |
+
"it",
|
| 1615 |
+
0xe1f1),
|
| 1616 |
+
],
|
| 1617 |
+
"bf": [
|
| 1618 |
+
("\N{DIGIT ZERO}",
|
| 1619 |
+
"\N{DIGIT NINE}",
|
| 1620 |
+
"bf",
|
| 1621 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD DIGIT ZERO}"),
|
| 1622 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1623 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1624 |
+
"bf",
|
| 1625 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD CAPITAL A}"),
|
| 1626 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1627 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1628 |
+
"bf",
|
| 1629 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD SMALL A}"),
|
| 1630 |
+
("\N{GREEK CAPITAL LETTER ALPHA}",
|
| 1631 |
+
"\N{GREEK CAPITAL LETTER OMEGA}",
|
| 1632 |
+
"bf",
|
| 1633 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD CAPITAL ALPHA}"),
|
| 1634 |
+
("\N{GREEK SMALL LETTER ALPHA}",
|
| 1635 |
+
"\N{GREEK SMALL LETTER OMEGA}",
|
| 1636 |
+
"bf",
|
| 1637 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD SMALL ALPHA}"),
|
| 1638 |
+
("\N{GREEK THETA SYMBOL}",
|
| 1639 |
+
"\N{GREEK THETA SYMBOL}",
|
| 1640 |
+
"bf",
|
| 1641 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD THETA SYMBOL}"),
|
| 1642 |
+
("\N{GREEK PHI SYMBOL}",
|
| 1643 |
+
"\N{GREEK PHI SYMBOL}",
|
| 1644 |
+
"bf",
|
| 1645 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD PHI SYMBOL}"),
|
| 1646 |
+
("\N{GREEK PI SYMBOL}",
|
| 1647 |
+
"\N{GREEK PI SYMBOL}",
|
| 1648 |
+
"bf",
|
| 1649 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD PI SYMBOL}"),
|
| 1650 |
+
("\N{GREEK KAPPA SYMBOL}",
|
| 1651 |
+
"\N{GREEK KAPPA SYMBOL}",
|
| 1652 |
+
"bf",
|
| 1653 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD KAPPA SYMBOL}"),
|
| 1654 |
+
("\N{GREEK RHO SYMBOL}",
|
| 1655 |
+
"\N{GREEK RHO SYMBOL}",
|
| 1656 |
+
"bf",
|
| 1657 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD RHO SYMBOL}"),
|
| 1658 |
+
("\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1659 |
+
"\N{GREEK LUNATE EPSILON SYMBOL}",
|
| 1660 |
+
"bf",
|
| 1661 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD EPSILON SYMBOL}"),
|
| 1662 |
+
("\N{PARTIAL DIFFERENTIAL}",
|
| 1663 |
+
"\N{PARTIAL DIFFERENTIAL}",
|
| 1664 |
+
"bf",
|
| 1665 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL}"),
|
| 1666 |
+
("\N{NABLA}",
|
| 1667 |
+
"\N{NABLA}",
|
| 1668 |
+
"bf",
|
| 1669 |
+
"\N{MATHEMATICAL SANS-SERIF BOLD NABLA}"),
|
| 1670 |
+
],
|
| 1671 |
+
"bfit": [
|
| 1672 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1673 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1674 |
+
"bfit",
|
| 1675 |
+
"\N{MATHEMATICAL BOLD ITALIC CAPITAL A}"),
|
| 1676 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1677 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1678 |
+
"bfit",
|
| 1679 |
+
"\N{MATHEMATICAL BOLD ITALIC SMALL A}"),
|
| 1680 |
+
("\N{GREEK CAPITAL LETTER GAMMA}",
|
| 1681 |
+
"\N{GREEK CAPITAL LETTER OMEGA}",
|
| 1682 |
+
"bfit",
|
| 1683 |
+
"\N{MATHEMATICAL BOLD ITALIC CAPITAL GAMMA}"),
|
| 1684 |
+
("\N{GREEK SMALL LETTER ALPHA}",
|
| 1685 |
+
"\N{GREEK SMALL LETTER OMEGA}",
|
| 1686 |
+
"bfit",
|
| 1687 |
+
"\N{MATHEMATICAL BOLD ITALIC SMALL ALPHA}"),
|
| 1688 |
+
],
|
| 1689 |
+
},
|
| 1690 |
+
'tt': [
|
| 1691 |
+
("\N{DIGIT ZERO}",
|
| 1692 |
+
"\N{DIGIT NINE}",
|
| 1693 |
+
"rm",
|
| 1694 |
+
"\N{MATHEMATICAL MONOSPACE DIGIT ZERO}"),
|
| 1695 |
+
("\N{LATIN CAPITAL LETTER A}",
|
| 1696 |
+
"\N{LATIN CAPITAL LETTER Z}",
|
| 1697 |
+
"rm",
|
| 1698 |
+
"\N{MATHEMATICAL MONOSPACE CAPITAL A}"),
|
| 1699 |
+
("\N{LATIN SMALL LETTER A}",
|
| 1700 |
+
"\N{LATIN SMALL LETTER Z}",
|
| 1701 |
+
"rm",
|
| 1702 |
+
"\N{MATHEMATICAL MONOSPACE SMALL A}")
|
| 1703 |
+
],
|
| 1704 |
+
}
|
| 1705 |
+
|
| 1706 |
+
|
| 1707 |
+
@overload
|
| 1708 |
+
def _normalize_stix_fontcodes(d: _EntryTypeIn) -> _EntryTypeOut: ...
|
| 1709 |
+
|
| 1710 |
+
|
| 1711 |
+
@overload
|
| 1712 |
+
def _normalize_stix_fontcodes(d: list[_EntryTypeIn]) -> list[_EntryTypeOut]: ...
|
| 1713 |
+
|
| 1714 |
+
|
| 1715 |
+
@overload
|
| 1716 |
+
def _normalize_stix_fontcodes(d: dict[str, list[_EntryTypeIn] |
|
| 1717 |
+
dict[str, list[_EntryTypeIn]]]
|
| 1718 |
+
) -> dict[str, list[_EntryTypeOut] |
|
| 1719 |
+
dict[str, list[_EntryTypeOut]]]: ...
|
| 1720 |
+
|
| 1721 |
+
|
| 1722 |
+
def _normalize_stix_fontcodes(d):
|
| 1723 |
+
if isinstance(d, tuple):
|
| 1724 |
+
return tuple(ord(x) if isinstance(x, str) and len(x) == 1 else x for x in d)
|
| 1725 |
+
elif isinstance(d, list):
|
| 1726 |
+
return [_normalize_stix_fontcodes(x) for x in d]
|
| 1727 |
+
elif isinstance(d, dict):
|
| 1728 |
+
return {k: _normalize_stix_fontcodes(v) for k, v in d.items()}
|
| 1729 |
+
|
| 1730 |
+
|
| 1731 |
+
stix_virtual_fonts: dict[str, dict[str, list[_EntryTypeOut]] | list[_EntryTypeOut]]
|
| 1732 |
+
stix_virtual_fonts = _normalize_stix_fontcodes(_stix_virtual_fonts)
|
| 1733 |
+
|
| 1734 |
+
# Free redundant list now that it has been normalized
|
| 1735 |
+
del _stix_virtual_fonts
|
| 1736 |
+
|
| 1737 |
+
# Fix some incorrect glyphs.
|
| 1738 |
+
stix_glyph_fixes = {
|
| 1739 |
+
# Cap and Cup glyphs are swapped.
|
| 1740 |
+
0x22d2: 0x22d3,
|
| 1741 |
+
0x22d3: 0x22d2,
|
| 1742 |
+
}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_path.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
from .transforms import BboxBase
|
| 6 |
+
|
| 7 |
+
def affine_transform(points: np.ndarray, trans: np.ndarray) -> np.ndarray: ...
|
| 8 |
+
def count_bboxes_overlapping_bbox(bbox: BboxBase, bboxes: Sequence[BboxBase]) -> int: ...
|
| 9 |
+
def update_path_extents(path, trans, rect, minpos, ignore): ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_pylab_helpers.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Manage figures for the pyplot interface.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import atexit
|
| 6 |
+
from collections import OrderedDict
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Gcf:
|
| 10 |
+
"""
|
| 11 |
+
Singleton to maintain the relation between figures and their managers, and
|
| 12 |
+
keep track of and "active" figure and manager.
|
| 13 |
+
|
| 14 |
+
The canvas of a figure created through pyplot is associated with a figure
|
| 15 |
+
manager, which handles the interaction between the figure and the backend.
|
| 16 |
+
pyplot keeps track of figure managers using an identifier, the "figure
|
| 17 |
+
number" or "manager number" (which can actually be any hashable value);
|
| 18 |
+
this number is available as the :attr:`number` attribute of the manager.
|
| 19 |
+
|
| 20 |
+
This class is never instantiated; it consists of an `OrderedDict` mapping
|
| 21 |
+
figure/manager numbers to managers, and a set of class methods that
|
| 22 |
+
manipulate this `OrderedDict`.
|
| 23 |
+
|
| 24 |
+
Attributes
|
| 25 |
+
----------
|
| 26 |
+
figs : OrderedDict
|
| 27 |
+
`OrderedDict` mapping numbers to managers; the active manager is at the
|
| 28 |
+
end.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
figs = OrderedDict()
|
| 32 |
+
|
| 33 |
+
@classmethod
|
| 34 |
+
def get_fig_manager(cls, num):
|
| 35 |
+
"""
|
| 36 |
+
If manager number *num* exists, make it the active one and return it;
|
| 37 |
+
otherwise return *None*.
|
| 38 |
+
"""
|
| 39 |
+
manager = cls.figs.get(num, None)
|
| 40 |
+
if manager is not None:
|
| 41 |
+
cls.set_active(manager)
|
| 42 |
+
return manager
|
| 43 |
+
|
| 44 |
+
@classmethod
|
| 45 |
+
def destroy(cls, num):
|
| 46 |
+
"""
|
| 47 |
+
Destroy manager *num* -- either a manager instance or a manager number.
|
| 48 |
+
|
| 49 |
+
In the interactive backends, this is bound to the window "destroy" and
|
| 50 |
+
"delete" events.
|
| 51 |
+
|
| 52 |
+
It is recommended to pass a manager instance, to avoid confusion when
|
| 53 |
+
two managers share the same number.
|
| 54 |
+
"""
|
| 55 |
+
if all(hasattr(num, attr) for attr in ["num", "destroy"]):
|
| 56 |
+
manager = num
|
| 57 |
+
if cls.figs.get(manager.num) is manager:
|
| 58 |
+
cls.figs.pop(manager.num)
|
| 59 |
+
else:
|
| 60 |
+
try:
|
| 61 |
+
manager = cls.figs.pop(num)
|
| 62 |
+
except KeyError:
|
| 63 |
+
return
|
| 64 |
+
if hasattr(manager, "_cidgcf"):
|
| 65 |
+
manager.canvas.mpl_disconnect(manager._cidgcf)
|
| 66 |
+
manager.destroy()
|
| 67 |
+
|
| 68 |
+
@classmethod
|
| 69 |
+
def destroy_fig(cls, fig):
|
| 70 |
+
"""Destroy figure *fig*."""
|
| 71 |
+
num = next((manager.num for manager in cls.figs.values()
|
| 72 |
+
if manager.canvas.figure == fig), None)
|
| 73 |
+
if num is not None:
|
| 74 |
+
cls.destroy(num)
|
| 75 |
+
|
| 76 |
+
@classmethod
|
| 77 |
+
def destroy_all(cls):
|
| 78 |
+
"""Destroy all figures."""
|
| 79 |
+
for manager in list(cls.figs.values()):
|
| 80 |
+
manager.canvas.mpl_disconnect(manager._cidgcf)
|
| 81 |
+
manager.destroy()
|
| 82 |
+
cls.figs.clear()
|
| 83 |
+
|
| 84 |
+
@classmethod
|
| 85 |
+
def has_fignum(cls, num):
|
| 86 |
+
"""Return whether figure number *num* exists."""
|
| 87 |
+
return num in cls.figs
|
| 88 |
+
|
| 89 |
+
@classmethod
|
| 90 |
+
def get_all_fig_managers(cls):
|
| 91 |
+
"""Return a list of figure managers."""
|
| 92 |
+
return list(cls.figs.values())
|
| 93 |
+
|
| 94 |
+
@classmethod
|
| 95 |
+
def get_num_fig_managers(cls):
|
| 96 |
+
"""Return the number of figures being managed."""
|
| 97 |
+
return len(cls.figs)
|
| 98 |
+
|
| 99 |
+
@classmethod
|
| 100 |
+
def get_active(cls):
|
| 101 |
+
"""Return the active manager, or *None* if there is no manager."""
|
| 102 |
+
return next(reversed(cls.figs.values())) if cls.figs else None
|
| 103 |
+
|
| 104 |
+
@classmethod
|
| 105 |
+
def _set_new_active_manager(cls, manager):
|
| 106 |
+
"""Adopt *manager* into pyplot and make it the active manager."""
|
| 107 |
+
if not hasattr(manager, "_cidgcf"):
|
| 108 |
+
manager._cidgcf = manager.canvas.mpl_connect(
|
| 109 |
+
"button_press_event", lambda event: cls.set_active(manager))
|
| 110 |
+
fig = manager.canvas.figure
|
| 111 |
+
fig._number = manager.num
|
| 112 |
+
label = fig.get_label()
|
| 113 |
+
if label:
|
| 114 |
+
manager.set_window_title(label)
|
| 115 |
+
cls.set_active(manager)
|
| 116 |
+
|
| 117 |
+
@classmethod
|
| 118 |
+
def set_active(cls, manager):
|
| 119 |
+
"""Make *manager* the active manager."""
|
| 120 |
+
cls.figs[manager.num] = manager
|
| 121 |
+
cls.figs.move_to_end(manager.num)
|
| 122 |
+
|
| 123 |
+
@classmethod
|
| 124 |
+
def draw_all(cls, force=False):
|
| 125 |
+
"""
|
| 126 |
+
Redraw all stale managed figures, or, if *force* is True, all managed
|
| 127 |
+
figures.
|
| 128 |
+
"""
|
| 129 |
+
for manager in cls.get_all_fig_managers():
|
| 130 |
+
if force or manager.canvas.figure.stale:
|
| 131 |
+
manager.canvas.draw_idle()
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
atexit.register(Gcf.destroy_all)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_pylab_helpers.pyi
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import OrderedDict
|
| 2 |
+
|
| 3 |
+
from matplotlib.backend_bases import FigureManagerBase
|
| 4 |
+
from matplotlib.figure import Figure
|
| 5 |
+
|
| 6 |
+
class Gcf:
|
| 7 |
+
figs: OrderedDict[int, FigureManagerBase]
|
| 8 |
+
@classmethod
|
| 9 |
+
def get_fig_manager(cls, num: int) -> FigureManagerBase | None: ...
|
| 10 |
+
@classmethod
|
| 11 |
+
def destroy(cls, num: int | FigureManagerBase) -> None: ...
|
| 12 |
+
@classmethod
|
| 13 |
+
def destroy_fig(cls, fig: Figure) -> None: ...
|
| 14 |
+
@classmethod
|
| 15 |
+
def destroy_all(cls) -> None: ...
|
| 16 |
+
@classmethod
|
| 17 |
+
def has_fignum(cls, num: int) -> bool: ...
|
| 18 |
+
@classmethod
|
| 19 |
+
def get_all_fig_managers(cls) -> list[FigureManagerBase]: ...
|
| 20 |
+
@classmethod
|
| 21 |
+
def get_num_fig_managers(cls) -> int: ...
|
| 22 |
+
@classmethod
|
| 23 |
+
def get_active(cls) -> FigureManagerBase | None: ...
|
| 24 |
+
@classmethod
|
| 25 |
+
def _set_new_active_manager(cls, manager: FigureManagerBase) -> None: ...
|
| 26 |
+
@classmethod
|
| 27 |
+
def set_active(cls, manager: FigureManagerBase) -> None: ...
|
| 28 |
+
@classmethod
|
| 29 |
+
def draw_all(cls, force: bool = ...) -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_qhull.pyi
ADDED
|
File without changes
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_text_helpers.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Low-level text helper utilities.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import dataclasses
|
| 8 |
+
|
| 9 |
+
from . import _api
|
| 10 |
+
from .ft2font import FT2Font, Kerning, LoadFlags
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@dataclasses.dataclass(frozen=True)
|
| 14 |
+
class LayoutItem:
|
| 15 |
+
ft_object: FT2Font
|
| 16 |
+
char: str
|
| 17 |
+
glyph_idx: int
|
| 18 |
+
x: float
|
| 19 |
+
prev_kern: float
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def warn_on_missing_glyph(codepoint, fontnames):
|
| 23 |
+
_api.warn_external(
|
| 24 |
+
f"Glyph {codepoint} "
|
| 25 |
+
f"({chr(codepoint).encode('ascii', 'namereplace').decode('ascii')}) "
|
| 26 |
+
f"missing from font(s) {fontnames}.")
|
| 27 |
+
|
| 28 |
+
block = ("Hebrew" if 0x0590 <= codepoint <= 0x05ff else
|
| 29 |
+
"Arabic" if 0x0600 <= codepoint <= 0x06ff else
|
| 30 |
+
"Devanagari" if 0x0900 <= codepoint <= 0x097f else
|
| 31 |
+
"Bengali" if 0x0980 <= codepoint <= 0x09ff else
|
| 32 |
+
"Gurmukhi" if 0x0a00 <= codepoint <= 0x0a7f else
|
| 33 |
+
"Gujarati" if 0x0a80 <= codepoint <= 0x0aff else
|
| 34 |
+
"Oriya" if 0x0b00 <= codepoint <= 0x0b7f else
|
| 35 |
+
"Tamil" if 0x0b80 <= codepoint <= 0x0bff else
|
| 36 |
+
"Telugu" if 0x0c00 <= codepoint <= 0x0c7f else
|
| 37 |
+
"Kannada" if 0x0c80 <= codepoint <= 0x0cff else
|
| 38 |
+
"Malayalam" if 0x0d00 <= codepoint <= 0x0d7f else
|
| 39 |
+
"Sinhala" if 0x0d80 <= codepoint <= 0x0dff else
|
| 40 |
+
None)
|
| 41 |
+
if block:
|
| 42 |
+
_api.warn_external(
|
| 43 |
+
f"Matplotlib currently does not support {block} natively.")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def layout(string, font, *, kern_mode=Kerning.DEFAULT):
|
| 47 |
+
"""
|
| 48 |
+
Render *string* with *font*.
|
| 49 |
+
|
| 50 |
+
For each character in *string*, yield a LayoutItem instance. When such an instance
|
| 51 |
+
is yielded, the font's glyph is set to the corresponding character.
|
| 52 |
+
|
| 53 |
+
Parameters
|
| 54 |
+
----------
|
| 55 |
+
string : str
|
| 56 |
+
The string to be rendered.
|
| 57 |
+
font : FT2Font
|
| 58 |
+
The font.
|
| 59 |
+
kern_mode : Kerning
|
| 60 |
+
A FreeType kerning mode.
|
| 61 |
+
|
| 62 |
+
Yields
|
| 63 |
+
------
|
| 64 |
+
LayoutItem
|
| 65 |
+
"""
|
| 66 |
+
x = 0
|
| 67 |
+
prev_glyph_idx = None
|
| 68 |
+
char_to_font = font._get_fontmap(string)
|
| 69 |
+
base_font = font
|
| 70 |
+
for char in string:
|
| 71 |
+
# This has done the fallback logic
|
| 72 |
+
font = char_to_font.get(char, base_font)
|
| 73 |
+
glyph_idx = font.get_char_index(ord(char))
|
| 74 |
+
kern = (
|
| 75 |
+
base_font.get_kerning(prev_glyph_idx, glyph_idx, kern_mode) / 64
|
| 76 |
+
if prev_glyph_idx is not None else 0.
|
| 77 |
+
)
|
| 78 |
+
x += kern
|
| 79 |
+
glyph = font.load_glyph(glyph_idx, flags=LoadFlags.NO_HINTING)
|
| 80 |
+
yield LayoutItem(font, char, glyph_idx, x, kern)
|
| 81 |
+
x += glyph.linearHoriAdvance / 65536
|
| 82 |
+
prev_glyph_idx = glyph_idx
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tight_bbox.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Helper module for the *bbox_inches* parameter in `.Figure.savefig`.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def adjust_bbox(fig, bbox_inches, fixed_dpi=None):
|
| 9 |
+
"""
|
| 10 |
+
Temporarily adjust the figure so that only the specified area
|
| 11 |
+
(bbox_inches) is saved.
|
| 12 |
+
|
| 13 |
+
It modifies fig.bbox, fig.bbox_inches,
|
| 14 |
+
fig.transFigure._boxout, and fig.patch. While the figure size
|
| 15 |
+
changes, the scale of the original figure is conserved. A
|
| 16 |
+
function which restores the original values are returned.
|
| 17 |
+
"""
|
| 18 |
+
origBbox = fig.bbox
|
| 19 |
+
origBboxInches = fig.bbox_inches
|
| 20 |
+
_boxout = fig.transFigure._boxout
|
| 21 |
+
|
| 22 |
+
old_aspect = []
|
| 23 |
+
locator_list = []
|
| 24 |
+
sentinel = object()
|
| 25 |
+
for ax in fig.axes:
|
| 26 |
+
locator = ax.get_axes_locator()
|
| 27 |
+
if locator is not None:
|
| 28 |
+
ax.apply_aspect(locator(ax, None))
|
| 29 |
+
locator_list.append(locator)
|
| 30 |
+
current_pos = ax.get_position(original=False).frozen()
|
| 31 |
+
ax.set_axes_locator(lambda a, r, _pos=current_pos: _pos)
|
| 32 |
+
# override the method that enforces the aspect ratio on the Axes
|
| 33 |
+
if 'apply_aspect' in ax.__dict__:
|
| 34 |
+
old_aspect.append(ax.apply_aspect)
|
| 35 |
+
else:
|
| 36 |
+
old_aspect.append(sentinel)
|
| 37 |
+
ax.apply_aspect = lambda pos=None: None
|
| 38 |
+
|
| 39 |
+
def restore_bbox():
|
| 40 |
+
for ax, loc, aspect in zip(fig.axes, locator_list, old_aspect):
|
| 41 |
+
ax.set_axes_locator(loc)
|
| 42 |
+
if aspect is sentinel:
|
| 43 |
+
# delete our no-op function which un-hides the original method
|
| 44 |
+
del ax.apply_aspect
|
| 45 |
+
else:
|
| 46 |
+
ax.apply_aspect = aspect
|
| 47 |
+
|
| 48 |
+
fig.bbox = origBbox
|
| 49 |
+
fig.bbox_inches = origBboxInches
|
| 50 |
+
fig.transFigure._boxout = _boxout
|
| 51 |
+
fig.transFigure.invalidate()
|
| 52 |
+
fig.patch.set_bounds(0, 0, 1, 1)
|
| 53 |
+
|
| 54 |
+
if fixed_dpi is None:
|
| 55 |
+
fixed_dpi = fig.dpi
|
| 56 |
+
tr = Affine2D().scale(fixed_dpi)
|
| 57 |
+
dpi_scale = fixed_dpi / fig.dpi
|
| 58 |
+
|
| 59 |
+
fig.bbox_inches = Bbox.from_bounds(0, 0, *bbox_inches.size)
|
| 60 |
+
x0, y0 = tr.transform(bbox_inches.p0)
|
| 61 |
+
w1, h1 = fig.bbox.size * dpi_scale
|
| 62 |
+
fig.transFigure._boxout = Bbox.from_bounds(-x0, -y0, w1, h1)
|
| 63 |
+
fig.transFigure.invalidate()
|
| 64 |
+
|
| 65 |
+
fig.bbox = TransformedBbox(fig.bbox_inches, tr)
|
| 66 |
+
|
| 67 |
+
fig.patch.set_bounds(x0 / w1, y0 / h1,
|
| 68 |
+
fig.bbox.width / w1, fig.bbox.height / h1)
|
| 69 |
+
|
| 70 |
+
return restore_bbox
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None):
|
| 74 |
+
"""
|
| 75 |
+
A function that needs to be called when figure dpi changes during the
|
| 76 |
+
drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with
|
| 77 |
+
the new dpi.
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
bbox_inches, restore_bbox = bbox_inches_restore
|
| 81 |
+
restore_bbox()
|
| 82 |
+
r = adjust_bbox(fig, bbox_inches, fixed_dpi)
|
| 83 |
+
|
| 84 |
+
return bbox_inches, r
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tight_layout.py
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Routines to adjust subplot params so that subplots are
|
| 3 |
+
nicely fit in the figure. In doing so, only axis labels, tick labels, Axes
|
| 4 |
+
titles and offsetboxes that are anchored to Axes are currently considered.
|
| 5 |
+
|
| 6 |
+
Internally, this module assumes that the margins (left margin, etc.) which are
|
| 7 |
+
differences between ``Axes.get_tightbbox`` and ``Axes.bbox`` are independent of
|
| 8 |
+
Axes position. This may fail if ``Axes.adjustable`` is ``datalim`` as well as
|
| 9 |
+
such cases as when left or right margin are affected by xlabel.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
|
| 14 |
+
import matplotlib as mpl
|
| 15 |
+
from matplotlib import _api, artist as martist
|
| 16 |
+
from matplotlib.font_manager import FontProperties
|
| 17 |
+
from matplotlib.transforms import Bbox
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def _auto_adjust_subplotpars(
|
| 21 |
+
fig, renderer, shape, span_pairs, subplot_list,
|
| 22 |
+
ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
|
| 23 |
+
"""
|
| 24 |
+
Return a dict of subplot parameters to adjust spacing between subplots
|
| 25 |
+
or ``None`` if resulting Axes would have zero height or width.
|
| 26 |
+
|
| 27 |
+
Note that this function ignores geometry information of subplot itself, but
|
| 28 |
+
uses what is given by the *shape* and *subplot_list* parameters. Also, the
|
| 29 |
+
results could be incorrect if some subplots have ``adjustable=datalim``.
|
| 30 |
+
|
| 31 |
+
Parameters
|
| 32 |
+
----------
|
| 33 |
+
shape : tuple[int, int]
|
| 34 |
+
Number of rows and columns of the grid.
|
| 35 |
+
span_pairs : list[tuple[slice, slice]]
|
| 36 |
+
List of rowspans and colspans occupied by each subplot.
|
| 37 |
+
subplot_list : list of subplots
|
| 38 |
+
List of subplots that will be used to calculate optimal subplot_params.
|
| 39 |
+
pad : float
|
| 40 |
+
Padding between the figure edge and the edges of subplots, as a
|
| 41 |
+
fraction of the font size.
|
| 42 |
+
h_pad, w_pad : float
|
| 43 |
+
Padding (height/width) between edges of adjacent subplots, as a
|
| 44 |
+
fraction of the font size. Defaults to *pad*.
|
| 45 |
+
rect : tuple
|
| 46 |
+
(left, bottom, right, top), default: None.
|
| 47 |
+
"""
|
| 48 |
+
rows, cols = shape
|
| 49 |
+
|
| 50 |
+
font_size_inch = (FontProperties(
|
| 51 |
+
size=mpl.rcParams["font.size"]).get_size_in_points() / 72)
|
| 52 |
+
pad_inch = pad * font_size_inch
|
| 53 |
+
vpad_inch = h_pad * font_size_inch if h_pad is not None else pad_inch
|
| 54 |
+
hpad_inch = w_pad * font_size_inch if w_pad is not None else pad_inch
|
| 55 |
+
|
| 56 |
+
if len(span_pairs) != len(subplot_list) or len(subplot_list) == 0:
|
| 57 |
+
raise ValueError
|
| 58 |
+
|
| 59 |
+
if rect is None:
|
| 60 |
+
margin_left = margin_bottom = margin_right = margin_top = None
|
| 61 |
+
else:
|
| 62 |
+
margin_left, margin_bottom, _right, _top = rect
|
| 63 |
+
margin_right = 1 - _right if _right else None
|
| 64 |
+
margin_top = 1 - _top if _top else None
|
| 65 |
+
|
| 66 |
+
vspaces = np.zeros((rows + 1, cols))
|
| 67 |
+
hspaces = np.zeros((rows, cols + 1))
|
| 68 |
+
|
| 69 |
+
if ax_bbox_list is None:
|
| 70 |
+
ax_bbox_list = [
|
| 71 |
+
Bbox.union([ax.get_position(original=True) for ax in subplots])
|
| 72 |
+
for subplots in subplot_list]
|
| 73 |
+
|
| 74 |
+
for subplots, ax_bbox, (rowspan, colspan) in zip(
|
| 75 |
+
subplot_list, ax_bbox_list, span_pairs):
|
| 76 |
+
if all(not ax.get_visible() for ax in subplots):
|
| 77 |
+
continue
|
| 78 |
+
|
| 79 |
+
bb = []
|
| 80 |
+
for ax in subplots:
|
| 81 |
+
if ax.get_visible():
|
| 82 |
+
bb += [martist._get_tightbbox_for_layout_only(ax, renderer)]
|
| 83 |
+
|
| 84 |
+
tight_bbox_raw = Bbox.union(bb)
|
| 85 |
+
tight_bbox = fig.transFigure.inverted().transform_bbox(tight_bbox_raw)
|
| 86 |
+
|
| 87 |
+
hspaces[rowspan, colspan.start] += ax_bbox.xmin - tight_bbox.xmin # l
|
| 88 |
+
hspaces[rowspan, colspan.stop] += tight_bbox.xmax - ax_bbox.xmax # r
|
| 89 |
+
vspaces[rowspan.start, colspan] += tight_bbox.ymax - ax_bbox.ymax # t
|
| 90 |
+
vspaces[rowspan.stop, colspan] += ax_bbox.ymin - tight_bbox.ymin # b
|
| 91 |
+
|
| 92 |
+
fig_width_inch, fig_height_inch = fig.get_size_inches()
|
| 93 |
+
|
| 94 |
+
# margins can be negative for Axes with aspect applied, so use max(, 0) to
|
| 95 |
+
# make them nonnegative.
|
| 96 |
+
if not margin_left:
|
| 97 |
+
margin_left = max(hspaces[:, 0].max(), 0) + pad_inch/fig_width_inch
|
| 98 |
+
suplabel = fig._supylabel
|
| 99 |
+
if suplabel and suplabel.get_in_layout():
|
| 100 |
+
rel_width = fig.transFigure.inverted().transform_bbox(
|
| 101 |
+
suplabel.get_window_extent(renderer)).width
|
| 102 |
+
margin_left += rel_width + pad_inch/fig_width_inch
|
| 103 |
+
if not margin_right:
|
| 104 |
+
margin_right = max(hspaces[:, -1].max(), 0) + pad_inch/fig_width_inch
|
| 105 |
+
if not margin_top:
|
| 106 |
+
margin_top = max(vspaces[0, :].max(), 0) + pad_inch/fig_height_inch
|
| 107 |
+
if fig._suptitle and fig._suptitle.get_in_layout():
|
| 108 |
+
rel_height = fig.transFigure.inverted().transform_bbox(
|
| 109 |
+
fig._suptitle.get_window_extent(renderer)).height
|
| 110 |
+
margin_top += rel_height + pad_inch/fig_height_inch
|
| 111 |
+
if not margin_bottom:
|
| 112 |
+
margin_bottom = max(vspaces[-1, :].max(), 0) + pad_inch/fig_height_inch
|
| 113 |
+
suplabel = fig._supxlabel
|
| 114 |
+
if suplabel and suplabel.get_in_layout():
|
| 115 |
+
rel_height = fig.transFigure.inverted().transform_bbox(
|
| 116 |
+
suplabel.get_window_extent(renderer)).height
|
| 117 |
+
margin_bottom += rel_height + pad_inch/fig_height_inch
|
| 118 |
+
|
| 119 |
+
if margin_left + margin_right >= 1:
|
| 120 |
+
_api.warn_external('Tight layout not applied. The left and right '
|
| 121 |
+
'margins cannot be made large enough to '
|
| 122 |
+
'accommodate all Axes decorations.')
|
| 123 |
+
return None
|
| 124 |
+
if margin_bottom + margin_top >= 1:
|
| 125 |
+
_api.warn_external('Tight layout not applied. The bottom and top '
|
| 126 |
+
'margins cannot be made large enough to '
|
| 127 |
+
'accommodate all Axes decorations.')
|
| 128 |
+
return None
|
| 129 |
+
|
| 130 |
+
kwargs = dict(left=margin_left,
|
| 131 |
+
right=1 - margin_right,
|
| 132 |
+
bottom=margin_bottom,
|
| 133 |
+
top=1 - margin_top)
|
| 134 |
+
|
| 135 |
+
if cols > 1:
|
| 136 |
+
hspace = hspaces[:, 1:-1].max() + hpad_inch / fig_width_inch
|
| 137 |
+
# axes widths:
|
| 138 |
+
h_axes = (1 - margin_right - margin_left - hspace * (cols - 1)) / cols
|
| 139 |
+
if h_axes < 0:
|
| 140 |
+
_api.warn_external('Tight layout not applied. tight_layout '
|
| 141 |
+
'cannot make Axes width small enough to '
|
| 142 |
+
'accommodate all Axes decorations')
|
| 143 |
+
return None
|
| 144 |
+
else:
|
| 145 |
+
kwargs["wspace"] = hspace / h_axes
|
| 146 |
+
if rows > 1:
|
| 147 |
+
vspace = vspaces[1:-1, :].max() + vpad_inch / fig_height_inch
|
| 148 |
+
v_axes = (1 - margin_top - margin_bottom - vspace * (rows - 1)) / rows
|
| 149 |
+
if v_axes < 0:
|
| 150 |
+
_api.warn_external('Tight layout not applied. tight_layout '
|
| 151 |
+
'cannot make Axes height small enough to '
|
| 152 |
+
'accommodate all Axes decorations.')
|
| 153 |
+
return None
|
| 154 |
+
else:
|
| 155 |
+
kwargs["hspace"] = vspace / v_axes
|
| 156 |
+
|
| 157 |
+
return kwargs
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def get_subplotspec_list(axes_list, grid_spec=None):
|
| 161 |
+
"""
|
| 162 |
+
Return a list of subplotspec from the given list of Axes.
|
| 163 |
+
|
| 164 |
+
For an instance of Axes that does not support subplotspec, None is inserted
|
| 165 |
+
in the list.
|
| 166 |
+
|
| 167 |
+
If grid_spec is given, None is inserted for those not from the given
|
| 168 |
+
grid_spec.
|
| 169 |
+
"""
|
| 170 |
+
subplotspec_list = []
|
| 171 |
+
for ax in axes_list:
|
| 172 |
+
axes_or_locator = ax.get_axes_locator()
|
| 173 |
+
if axes_or_locator is None:
|
| 174 |
+
axes_or_locator = ax
|
| 175 |
+
|
| 176 |
+
if hasattr(axes_or_locator, "get_subplotspec"):
|
| 177 |
+
subplotspec = axes_or_locator.get_subplotspec()
|
| 178 |
+
if subplotspec is not None:
|
| 179 |
+
subplotspec = subplotspec.get_topmost_subplotspec()
|
| 180 |
+
gs = subplotspec.get_gridspec()
|
| 181 |
+
if grid_spec is not None:
|
| 182 |
+
if gs != grid_spec:
|
| 183 |
+
subplotspec = None
|
| 184 |
+
elif gs.locally_modified_subplot_params():
|
| 185 |
+
subplotspec = None
|
| 186 |
+
else:
|
| 187 |
+
subplotspec = None
|
| 188 |
+
|
| 189 |
+
subplotspec_list.append(subplotspec)
|
| 190 |
+
|
| 191 |
+
return subplotspec_list
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
|
| 195 |
+
pad=1.08, h_pad=None, w_pad=None, rect=None):
|
| 196 |
+
"""
|
| 197 |
+
Return subplot parameters for tight-layouted-figure with specified padding.
|
| 198 |
+
|
| 199 |
+
Parameters
|
| 200 |
+
----------
|
| 201 |
+
fig : Figure
|
| 202 |
+
axes_list : list of Axes
|
| 203 |
+
subplotspec_list : list of `.SubplotSpec`
|
| 204 |
+
The subplotspecs of each Axes.
|
| 205 |
+
renderer : renderer
|
| 206 |
+
pad : float
|
| 207 |
+
Padding between the figure edge and the edges of subplots, as a
|
| 208 |
+
fraction of the font size.
|
| 209 |
+
h_pad, w_pad : float
|
| 210 |
+
Padding (height/width) between edges of adjacent subplots. Defaults to
|
| 211 |
+
*pad*.
|
| 212 |
+
rect : tuple (left, bottom, right, top), default: None.
|
| 213 |
+
rectangle in normalized figure coordinates
|
| 214 |
+
that the whole subplots area (including labels) will fit into.
|
| 215 |
+
Defaults to using the entire figure.
|
| 216 |
+
|
| 217 |
+
Returns
|
| 218 |
+
-------
|
| 219 |
+
subplotspec or None
|
| 220 |
+
subplotspec kwargs to be passed to `.Figure.subplots_adjust` or
|
| 221 |
+
None if tight_layout could not be accomplished.
|
| 222 |
+
"""
|
| 223 |
+
|
| 224 |
+
# Multiple Axes can share same subplotspec (e.g., if using axes_grid1);
|
| 225 |
+
# we need to group them together.
|
| 226 |
+
ss_to_subplots = {ss: [] for ss in subplotspec_list}
|
| 227 |
+
for ax, ss in zip(axes_list, subplotspec_list):
|
| 228 |
+
ss_to_subplots[ss].append(ax)
|
| 229 |
+
if ss_to_subplots.pop(None, None):
|
| 230 |
+
_api.warn_external(
|
| 231 |
+
"This figure includes Axes that are not compatible with "
|
| 232 |
+
"tight_layout, so results might be incorrect.")
|
| 233 |
+
if not ss_to_subplots:
|
| 234 |
+
return {}
|
| 235 |
+
subplot_list = list(ss_to_subplots.values())
|
| 236 |
+
ax_bbox_list = [ss.get_position(fig) for ss in ss_to_subplots]
|
| 237 |
+
|
| 238 |
+
max_nrows = max(ss.get_gridspec().nrows for ss in ss_to_subplots)
|
| 239 |
+
max_ncols = max(ss.get_gridspec().ncols for ss in ss_to_subplots)
|
| 240 |
+
|
| 241 |
+
span_pairs = []
|
| 242 |
+
for ss in ss_to_subplots:
|
| 243 |
+
# The intent here is to support Axes from different gridspecs where
|
| 244 |
+
# one's nrows (or ncols) is a multiple of the other (e.g. 2 and 4),
|
| 245 |
+
# but this doesn't actually work because the computed wspace, in
|
| 246 |
+
# relative-axes-height, corresponds to different physical spacings for
|
| 247 |
+
# the 2-row grid and the 4-row grid. Still, this code is left, mostly
|
| 248 |
+
# for backcompat.
|
| 249 |
+
rows, cols = ss.get_gridspec().get_geometry()
|
| 250 |
+
div_row, mod_row = divmod(max_nrows, rows)
|
| 251 |
+
div_col, mod_col = divmod(max_ncols, cols)
|
| 252 |
+
if mod_row != 0:
|
| 253 |
+
_api.warn_external('tight_layout not applied: number of rows '
|
| 254 |
+
'in subplot specifications must be '
|
| 255 |
+
'multiples of one another.')
|
| 256 |
+
return {}
|
| 257 |
+
if mod_col != 0:
|
| 258 |
+
_api.warn_external('tight_layout not applied: number of '
|
| 259 |
+
'columns in subplot specifications must be '
|
| 260 |
+
'multiples of one another.')
|
| 261 |
+
return {}
|
| 262 |
+
span_pairs.append((
|
| 263 |
+
slice(ss.rowspan.start * div_row, ss.rowspan.stop * div_row),
|
| 264 |
+
slice(ss.colspan.start * div_col, ss.colspan.stop * div_col)))
|
| 265 |
+
|
| 266 |
+
kwargs = _auto_adjust_subplotpars(fig, renderer,
|
| 267 |
+
shape=(max_nrows, max_ncols),
|
| 268 |
+
span_pairs=span_pairs,
|
| 269 |
+
subplot_list=subplot_list,
|
| 270 |
+
ax_bbox_list=ax_bbox_list,
|
| 271 |
+
pad=pad, h_pad=h_pad, w_pad=w_pad)
|
| 272 |
+
|
| 273 |
+
# kwargs can be none if tight_layout fails...
|
| 274 |
+
if rect is not None and kwargs is not None:
|
| 275 |
+
# if rect is given, the whole subplots area (including
|
| 276 |
+
# labels) will fit into the rect instead of the
|
| 277 |
+
# figure. Note that the rect argument of
|
| 278 |
+
# *auto_adjust_subplotpars* specify the area that will be
|
| 279 |
+
# covered by the total area of axes.bbox. Thus we call
|
| 280 |
+
# auto_adjust_subplotpars twice, where the second run
|
| 281 |
+
# with adjusted rect parameters.
|
| 282 |
+
|
| 283 |
+
left, bottom, right, top = rect
|
| 284 |
+
if left is not None:
|
| 285 |
+
left += kwargs["left"]
|
| 286 |
+
if bottom is not None:
|
| 287 |
+
bottom += kwargs["bottom"]
|
| 288 |
+
if right is not None:
|
| 289 |
+
right -= (1 - kwargs["right"])
|
| 290 |
+
if top is not None:
|
| 291 |
+
top -= (1 - kwargs["top"])
|
| 292 |
+
|
| 293 |
+
kwargs = _auto_adjust_subplotpars(fig, renderer,
|
| 294 |
+
shape=(max_nrows, max_ncols),
|
| 295 |
+
span_pairs=span_pairs,
|
| 296 |
+
subplot_list=subplot_list,
|
| 297 |
+
ax_bbox_list=ax_bbox_list,
|
| 298 |
+
pad=pad, h_pad=h_pad, w_pad=w_pad,
|
| 299 |
+
rect=(left, bottom, right, top))
|
| 300 |
+
|
| 301 |
+
return kwargs
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_tri.pyi
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This is a private module implemented in C++
|
| 2 |
+
from typing import final
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
import numpy.typing as npt
|
| 6 |
+
|
| 7 |
+
@final
|
| 8 |
+
class TrapezoidMapTriFinder:
|
| 9 |
+
def __init__(self, triangulation: Triangulation): ...
|
| 10 |
+
def find_many(self, x: npt.NDArray[np.float64], y: npt.NDArray[np.float64]) -> npt.NDArray[np.int_]: ...
|
| 11 |
+
def get_tree_stats(self) -> list[int | float]: ...
|
| 12 |
+
def initialize(self) -> None: ...
|
| 13 |
+
def print_tree(self) -> None: ...
|
| 14 |
+
|
| 15 |
+
@final
|
| 16 |
+
class TriContourGenerator:
|
| 17 |
+
def __init__(self, triangulation: Triangulation, z: npt.NDArray[np.float64]): ...
|
| 18 |
+
def create_contour(self, level: float) -> tuple[list[float], list[int]]: ...
|
| 19 |
+
def create_filled_contour(self, lower_level: float, upper_level: float) -> tuple[list[float], list[int]]: ...
|
| 20 |
+
|
| 21 |
+
@final
|
| 22 |
+
class Triangulation:
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
x: npt.NDArray[np.float64],
|
| 26 |
+
y: npt.NDArray[np.float64],
|
| 27 |
+
triangles: npt.NDArray[np.int_],
|
| 28 |
+
mask: npt.NDArray[np.bool_] | tuple[()],
|
| 29 |
+
edges: npt.NDArray[np.int_] | tuple[()],
|
| 30 |
+
neighbors: npt.NDArray[np.int_] | tuple[()],
|
| 31 |
+
correct_triangle_orientation: bool,
|
| 32 |
+
): ...
|
| 33 |
+
def calculate_plane_coefficients(self, z: npt.ArrayLike) -> npt.NDArray[np.float64]: ...
|
| 34 |
+
def get_edges(self) -> npt.NDArray[np.int_]: ...
|
| 35 |
+
def get_neighbors(self) -> npt.NDArray[np.int_]: ...
|
| 36 |
+
def set_mask(self, mask: npt.NDArray[np.bool_] | tuple[()]) -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/_type1font.py
ADDED
|
@@ -0,0 +1,879 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
This version reads pfa and pfb files and splits them for embedding in
|
| 5 |
+
pdf files. It also supports SlantFont and ExtendFont transformations,
|
| 6 |
+
similarly to pdfTeX and friends. There is no support yet for subsetting.
|
| 7 |
+
|
| 8 |
+
Usage::
|
| 9 |
+
|
| 10 |
+
font = Type1Font(filename)
|
| 11 |
+
clear_part, encrypted_part, finale = font.parts
|
| 12 |
+
slanted_font = font.transform({'slant': 0.167})
|
| 13 |
+
extended_font = font.transform({'extend': 1.2})
|
| 14 |
+
|
| 15 |
+
Sources:
|
| 16 |
+
|
| 17 |
+
* Adobe Technical Note #5040, Supporting Downloadable PostScript
|
| 18 |
+
Language Fonts.
|
| 19 |
+
|
| 20 |
+
* Adobe Type 1 Font Format, Adobe Systems Incorporated, third printing,
|
| 21 |
+
v1.1, 1993. ISBN 0-201-57044-0.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import binascii
|
| 27 |
+
import functools
|
| 28 |
+
import logging
|
| 29 |
+
import re
|
| 30 |
+
import string
|
| 31 |
+
import struct
|
| 32 |
+
import typing as T
|
| 33 |
+
|
| 34 |
+
import numpy as np
|
| 35 |
+
|
| 36 |
+
from matplotlib.cbook import _format_approx
|
| 37 |
+
from . import _api
|
| 38 |
+
|
| 39 |
+
_log = logging.getLogger(__name__)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class _Token:
|
| 43 |
+
"""
|
| 44 |
+
A token in a PostScript stream.
|
| 45 |
+
|
| 46 |
+
Attributes
|
| 47 |
+
----------
|
| 48 |
+
pos : int
|
| 49 |
+
Position, i.e. offset from the beginning of the data.
|
| 50 |
+
raw : str
|
| 51 |
+
Raw text of the token.
|
| 52 |
+
kind : str
|
| 53 |
+
Description of the token (for debugging or testing).
|
| 54 |
+
"""
|
| 55 |
+
__slots__ = ('pos', 'raw')
|
| 56 |
+
kind = '?'
|
| 57 |
+
|
| 58 |
+
def __init__(self, pos, raw):
|
| 59 |
+
_log.debug('type1font._Token %s at %d: %r', self.kind, pos, raw)
|
| 60 |
+
self.pos = pos
|
| 61 |
+
self.raw = raw
|
| 62 |
+
|
| 63 |
+
def __str__(self):
|
| 64 |
+
return f"<{self.kind} {self.raw} @{self.pos}>"
|
| 65 |
+
|
| 66 |
+
def endpos(self):
|
| 67 |
+
"""Position one past the end of the token"""
|
| 68 |
+
return self.pos + len(self.raw)
|
| 69 |
+
|
| 70 |
+
def is_keyword(self, *names):
|
| 71 |
+
"""Is this a name token with one of the names?"""
|
| 72 |
+
return False
|
| 73 |
+
|
| 74 |
+
def is_slash_name(self):
|
| 75 |
+
"""Is this a name token that starts with a slash?"""
|
| 76 |
+
return False
|
| 77 |
+
|
| 78 |
+
def is_delim(self):
|
| 79 |
+
"""Is this a delimiter token?"""
|
| 80 |
+
return False
|
| 81 |
+
|
| 82 |
+
def is_number(self):
|
| 83 |
+
"""Is this a number token?"""
|
| 84 |
+
return False
|
| 85 |
+
|
| 86 |
+
def value(self):
|
| 87 |
+
return self.raw
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class _NameToken(_Token):
|
| 91 |
+
kind = 'name'
|
| 92 |
+
|
| 93 |
+
def is_slash_name(self):
|
| 94 |
+
return self.raw.startswith('/')
|
| 95 |
+
|
| 96 |
+
def value(self):
|
| 97 |
+
return self.raw[1:]
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class _BooleanToken(_Token):
|
| 101 |
+
kind = 'boolean'
|
| 102 |
+
|
| 103 |
+
def value(self):
|
| 104 |
+
return self.raw == 'true'
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class _KeywordToken(_Token):
|
| 108 |
+
kind = 'keyword'
|
| 109 |
+
|
| 110 |
+
def is_keyword(self, *names):
|
| 111 |
+
return self.raw in names
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class _DelimiterToken(_Token):
|
| 115 |
+
kind = 'delimiter'
|
| 116 |
+
|
| 117 |
+
def is_delim(self):
|
| 118 |
+
return True
|
| 119 |
+
|
| 120 |
+
def opposite(self):
|
| 121 |
+
return {'[': ']', ']': '[',
|
| 122 |
+
'{': '}', '}': '{',
|
| 123 |
+
'<<': '>>', '>>': '<<'
|
| 124 |
+
}[self.raw]
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
class _WhitespaceToken(_Token):
|
| 128 |
+
kind = 'whitespace'
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
class _StringToken(_Token):
|
| 132 |
+
kind = 'string'
|
| 133 |
+
_escapes_re = re.compile(r'\\([\\()nrtbf]|[0-7]{1,3})')
|
| 134 |
+
_replacements = {'\\': '\\', '(': '(', ')': ')', 'n': '\n',
|
| 135 |
+
'r': '\r', 't': '\t', 'b': '\b', 'f': '\f'}
|
| 136 |
+
_ws_re = re.compile('[\0\t\r\f\n ]')
|
| 137 |
+
|
| 138 |
+
@classmethod
|
| 139 |
+
def _escape(cls, match):
|
| 140 |
+
group = match.group(1)
|
| 141 |
+
try:
|
| 142 |
+
return cls._replacements[group]
|
| 143 |
+
except KeyError:
|
| 144 |
+
return chr(int(group, 8))
|
| 145 |
+
|
| 146 |
+
@functools.lru_cache
|
| 147 |
+
def value(self):
|
| 148 |
+
if self.raw[0] == '(':
|
| 149 |
+
return self._escapes_re.sub(self._escape, self.raw[1:-1])
|
| 150 |
+
else:
|
| 151 |
+
data = self._ws_re.sub('', self.raw[1:-1])
|
| 152 |
+
if len(data) % 2 == 1:
|
| 153 |
+
data += '0'
|
| 154 |
+
return binascii.unhexlify(data)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
class _BinaryToken(_Token):
|
| 158 |
+
kind = 'binary'
|
| 159 |
+
|
| 160 |
+
def value(self):
|
| 161 |
+
return self.raw[1:]
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
class _NumberToken(_Token):
|
| 165 |
+
kind = 'number'
|
| 166 |
+
|
| 167 |
+
def is_number(self):
|
| 168 |
+
return True
|
| 169 |
+
|
| 170 |
+
def value(self):
|
| 171 |
+
if '.' not in self.raw:
|
| 172 |
+
return int(self.raw)
|
| 173 |
+
else:
|
| 174 |
+
return float(self.raw)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def _tokenize(data: bytes, skip_ws: bool) -> T.Generator[_Token, int, None]:
|
| 178 |
+
"""
|
| 179 |
+
A generator that produces _Token instances from Type-1 font code.
|
| 180 |
+
|
| 181 |
+
The consumer of the generator may send an integer to the tokenizer to
|
| 182 |
+
indicate that the next token should be _BinaryToken of the given length.
|
| 183 |
+
|
| 184 |
+
Parameters
|
| 185 |
+
----------
|
| 186 |
+
data : bytes
|
| 187 |
+
The data of the font to tokenize.
|
| 188 |
+
|
| 189 |
+
skip_ws : bool
|
| 190 |
+
If true, the generator will drop any _WhitespaceTokens from the output.
|
| 191 |
+
"""
|
| 192 |
+
|
| 193 |
+
text = data.decode('ascii', 'replace')
|
| 194 |
+
whitespace_or_comment_re = re.compile(r'[\0\t\r\f\n ]+|%[^\r\n]*')
|
| 195 |
+
token_re = re.compile(r'/{0,2}[^]\0\t\r\f\n ()<>{}/%[]+')
|
| 196 |
+
instring_re = re.compile(r'[()\\]')
|
| 197 |
+
hex_re = re.compile(r'^<[0-9a-fA-F\0\t\r\f\n ]*>$')
|
| 198 |
+
oct_re = re.compile(r'[0-7]{1,3}')
|
| 199 |
+
pos = 0
|
| 200 |
+
next_binary: int | None = None
|
| 201 |
+
|
| 202 |
+
while pos < len(text):
|
| 203 |
+
if next_binary is not None:
|
| 204 |
+
n = next_binary
|
| 205 |
+
next_binary = (yield _BinaryToken(pos, data[pos:pos+n]))
|
| 206 |
+
pos += n
|
| 207 |
+
continue
|
| 208 |
+
match = whitespace_or_comment_re.match(text, pos)
|
| 209 |
+
if match:
|
| 210 |
+
if not skip_ws:
|
| 211 |
+
next_binary = (yield _WhitespaceToken(pos, match.group()))
|
| 212 |
+
pos = match.end()
|
| 213 |
+
elif text[pos] == '(':
|
| 214 |
+
# PostScript string rules:
|
| 215 |
+
# - parentheses must be balanced
|
| 216 |
+
# - backslashes escape backslashes and parens
|
| 217 |
+
# - also codes \n\r\t\b\f and octal escapes are recognized
|
| 218 |
+
# - other backslashes do not escape anything
|
| 219 |
+
start = pos
|
| 220 |
+
pos += 1
|
| 221 |
+
depth = 1
|
| 222 |
+
while depth:
|
| 223 |
+
match = instring_re.search(text, pos)
|
| 224 |
+
if match is None:
|
| 225 |
+
raise ValueError(
|
| 226 |
+
f'Unterminated string starting at {start}')
|
| 227 |
+
pos = match.end()
|
| 228 |
+
if match.group() == '(':
|
| 229 |
+
depth += 1
|
| 230 |
+
elif match.group() == ')':
|
| 231 |
+
depth -= 1
|
| 232 |
+
else: # a backslash
|
| 233 |
+
char = text[pos]
|
| 234 |
+
if char in r'\()nrtbf':
|
| 235 |
+
pos += 1
|
| 236 |
+
else:
|
| 237 |
+
octal = oct_re.match(text, pos)
|
| 238 |
+
if octal:
|
| 239 |
+
pos = octal.end()
|
| 240 |
+
else:
|
| 241 |
+
pass # non-escaping backslash
|
| 242 |
+
next_binary = (yield _StringToken(start, text[start:pos]))
|
| 243 |
+
elif text[pos:pos + 2] in ('<<', '>>'):
|
| 244 |
+
next_binary = (yield _DelimiterToken(pos, text[pos:pos + 2]))
|
| 245 |
+
pos += 2
|
| 246 |
+
elif text[pos] == '<':
|
| 247 |
+
start = pos
|
| 248 |
+
try:
|
| 249 |
+
pos = text.index('>', pos) + 1
|
| 250 |
+
except ValueError as e:
|
| 251 |
+
raise ValueError(f'Unterminated hex string starting at {start}'
|
| 252 |
+
) from e
|
| 253 |
+
if not hex_re.match(text[start:pos]):
|
| 254 |
+
raise ValueError(f'Malformed hex string starting at {start}')
|
| 255 |
+
next_binary = (yield _StringToken(pos, text[start:pos]))
|
| 256 |
+
else:
|
| 257 |
+
match = token_re.match(text, pos)
|
| 258 |
+
if match:
|
| 259 |
+
raw = match.group()
|
| 260 |
+
if raw.startswith('/'):
|
| 261 |
+
next_binary = (yield _NameToken(pos, raw))
|
| 262 |
+
elif match.group() in ('true', 'false'):
|
| 263 |
+
next_binary = (yield _BooleanToken(pos, raw))
|
| 264 |
+
else:
|
| 265 |
+
try:
|
| 266 |
+
float(raw)
|
| 267 |
+
next_binary = (yield _NumberToken(pos, raw))
|
| 268 |
+
except ValueError:
|
| 269 |
+
next_binary = (yield _KeywordToken(pos, raw))
|
| 270 |
+
pos = match.end()
|
| 271 |
+
else:
|
| 272 |
+
next_binary = (yield _DelimiterToken(pos, text[pos]))
|
| 273 |
+
pos += 1
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
class _BalancedExpression(_Token):
|
| 277 |
+
pass
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def _expression(initial, tokens, data):
|
| 281 |
+
"""
|
| 282 |
+
Consume some number of tokens and return a balanced PostScript expression.
|
| 283 |
+
|
| 284 |
+
Parameters
|
| 285 |
+
----------
|
| 286 |
+
initial : _Token
|
| 287 |
+
The token that triggered parsing a balanced expression.
|
| 288 |
+
tokens : iterator of _Token
|
| 289 |
+
Following tokens.
|
| 290 |
+
data : bytes
|
| 291 |
+
Underlying data that the token positions point to.
|
| 292 |
+
|
| 293 |
+
Returns
|
| 294 |
+
-------
|
| 295 |
+
_BalancedExpression
|
| 296 |
+
"""
|
| 297 |
+
delim_stack = []
|
| 298 |
+
token = initial
|
| 299 |
+
while True:
|
| 300 |
+
if token.is_delim():
|
| 301 |
+
if token.raw in ('[', '{'):
|
| 302 |
+
delim_stack.append(token)
|
| 303 |
+
elif token.raw in (']', '}'):
|
| 304 |
+
if not delim_stack:
|
| 305 |
+
raise RuntimeError(f"unmatched closing token {token}")
|
| 306 |
+
match = delim_stack.pop()
|
| 307 |
+
if match.raw != token.opposite():
|
| 308 |
+
raise RuntimeError(
|
| 309 |
+
f"opening token {match} closed by {token}"
|
| 310 |
+
)
|
| 311 |
+
if not delim_stack:
|
| 312 |
+
break
|
| 313 |
+
else:
|
| 314 |
+
raise RuntimeError(f'unknown delimiter {token}')
|
| 315 |
+
elif not delim_stack:
|
| 316 |
+
break
|
| 317 |
+
token = next(tokens)
|
| 318 |
+
return _BalancedExpression(
|
| 319 |
+
initial.pos,
|
| 320 |
+
data[initial.pos:token.endpos()].decode('ascii', 'replace')
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
class Type1Font:
|
| 325 |
+
"""
|
| 326 |
+
A class representing a Type-1 font, for use by backends.
|
| 327 |
+
|
| 328 |
+
Attributes
|
| 329 |
+
----------
|
| 330 |
+
parts : tuple
|
| 331 |
+
A 3-tuple of the cleartext part, the encrypted part, and the finale of
|
| 332 |
+
zeros.
|
| 333 |
+
|
| 334 |
+
decrypted : bytes
|
| 335 |
+
The decrypted form of ``parts[1]``.
|
| 336 |
+
|
| 337 |
+
prop : dict[str, Any]
|
| 338 |
+
A dictionary of font properties. Noteworthy keys include:
|
| 339 |
+
|
| 340 |
+
- FontName: PostScript name of the font
|
| 341 |
+
- Encoding: dict from numeric codes to glyph names
|
| 342 |
+
- FontMatrix: bytes object encoding a matrix
|
| 343 |
+
- UniqueID: optional font identifier, dropped when modifying the font
|
| 344 |
+
- CharStrings: dict from glyph names to byte code
|
| 345 |
+
- Subrs: array of byte code subroutines
|
| 346 |
+
- OtherSubrs: bytes object encoding some PostScript code
|
| 347 |
+
"""
|
| 348 |
+
__slots__ = ('parts', 'decrypted', 'prop', '_pos', '_abbr')
|
| 349 |
+
# the _pos dict contains (begin, end) indices to parts[0] + decrypted
|
| 350 |
+
# so that they can be replaced when transforming the font;
|
| 351 |
+
# but since sometimes a definition appears in both parts[0] and decrypted,
|
| 352 |
+
# _pos[name] is an array of such pairs
|
| 353 |
+
#
|
| 354 |
+
# _abbr maps three standard abbreviations to their particular names in
|
| 355 |
+
# this font (e.g. 'RD' is named '-|' in some fonts)
|
| 356 |
+
|
| 357 |
+
def __init__(self, input):
|
| 358 |
+
"""
|
| 359 |
+
Initialize a Type-1 font.
|
| 360 |
+
|
| 361 |
+
Parameters
|
| 362 |
+
----------
|
| 363 |
+
input : str or 3-tuple
|
| 364 |
+
Either a pfb file name, or a 3-tuple of already-decoded Type-1
|
| 365 |
+
font `~.Type1Font.parts`.
|
| 366 |
+
"""
|
| 367 |
+
if isinstance(input, tuple) and len(input) == 3:
|
| 368 |
+
self.parts = input
|
| 369 |
+
else:
|
| 370 |
+
with open(input, 'rb') as file:
|
| 371 |
+
data = self._read(file)
|
| 372 |
+
self.parts = self._split(data)
|
| 373 |
+
|
| 374 |
+
self.decrypted = self._decrypt(self.parts[1], 'eexec')
|
| 375 |
+
self._abbr = {'RD': 'RD', 'ND': 'ND', 'NP': 'NP'}
|
| 376 |
+
self._parse()
|
| 377 |
+
|
| 378 |
+
def _read(self, file):
|
| 379 |
+
"""Read the font from a file, decoding into usable parts."""
|
| 380 |
+
rawdata = file.read()
|
| 381 |
+
if not rawdata.startswith(b'\x80'):
|
| 382 |
+
return rawdata
|
| 383 |
+
|
| 384 |
+
data = b''
|
| 385 |
+
while rawdata:
|
| 386 |
+
if not rawdata.startswith(b'\x80'):
|
| 387 |
+
raise RuntimeError('Broken pfb file (expected byte 128, '
|
| 388 |
+
'got %d)' % rawdata[0])
|
| 389 |
+
type = rawdata[1]
|
| 390 |
+
if type in (1, 2):
|
| 391 |
+
length, = struct.unpack('<i', rawdata[2:6])
|
| 392 |
+
segment = rawdata[6:6 + length]
|
| 393 |
+
rawdata = rawdata[6 + length:]
|
| 394 |
+
|
| 395 |
+
if type == 1: # ASCII text: include verbatim
|
| 396 |
+
data += segment
|
| 397 |
+
elif type == 2: # binary data: encode in hexadecimal
|
| 398 |
+
data += binascii.hexlify(segment)
|
| 399 |
+
elif type == 3: # end of file
|
| 400 |
+
break
|
| 401 |
+
else:
|
| 402 |
+
raise RuntimeError('Unknown segment type %d in pfb file' % type)
|
| 403 |
+
|
| 404 |
+
return data
|
| 405 |
+
|
| 406 |
+
def _split(self, data):
|
| 407 |
+
"""
|
| 408 |
+
Split the Type 1 font into its three main parts.
|
| 409 |
+
|
| 410 |
+
The three parts are: (1) the cleartext part, which ends in a
|
| 411 |
+
eexec operator; (2) the encrypted part; (3) the fixed part,
|
| 412 |
+
which contains 512 ASCII zeros possibly divided on various
|
| 413 |
+
lines, a cleartomark operator, and possibly something else.
|
| 414 |
+
"""
|
| 415 |
+
|
| 416 |
+
# Cleartext part: just find the eexec and skip whitespace
|
| 417 |
+
idx = data.index(b'eexec')
|
| 418 |
+
idx += len(b'eexec')
|
| 419 |
+
while data[idx] in b' \t\r\n':
|
| 420 |
+
idx += 1
|
| 421 |
+
len1 = idx
|
| 422 |
+
|
| 423 |
+
# Encrypted part: find the cleartomark operator and count
|
| 424 |
+
# zeros backward
|
| 425 |
+
idx = data.rindex(b'cleartomark') - 1
|
| 426 |
+
zeros = 512
|
| 427 |
+
while zeros and data[idx] in b'0' or data[idx] in b'\r\n':
|
| 428 |
+
if data[idx] in b'0':
|
| 429 |
+
zeros -= 1
|
| 430 |
+
idx -= 1
|
| 431 |
+
if zeros:
|
| 432 |
+
# this may have been a problem on old implementations that
|
| 433 |
+
# used the zeros as necessary padding
|
| 434 |
+
_log.info('Insufficiently many zeros in Type 1 font')
|
| 435 |
+
|
| 436 |
+
# Convert encrypted part to binary (if we read a pfb file, we may end
|
| 437 |
+
# up converting binary to hexadecimal to binary again; but if we read
|
| 438 |
+
# a pfa file, this part is already in hex, and I am not quite sure if
|
| 439 |
+
# even the pfb format guarantees that it will be in binary).
|
| 440 |
+
idx1 = len1 + ((idx - len1 + 2) & ~1) # ensure an even number of bytes
|
| 441 |
+
binary = binascii.unhexlify(data[len1:idx1])
|
| 442 |
+
|
| 443 |
+
return data[:len1], binary, data[idx+1:]
|
| 444 |
+
|
| 445 |
+
@staticmethod
|
| 446 |
+
def _decrypt(ciphertext, key, ndiscard=4):
|
| 447 |
+
"""
|
| 448 |
+
Decrypt ciphertext using the Type-1 font algorithm.
|
| 449 |
+
|
| 450 |
+
The algorithm is described in Adobe's "Adobe Type 1 Font Format".
|
| 451 |
+
The key argument can be an integer, or one of the strings
|
| 452 |
+
'eexec' and 'charstring', which map to the key specified for the
|
| 453 |
+
corresponding part of Type-1 fonts.
|
| 454 |
+
|
| 455 |
+
The ndiscard argument should be an integer, usually 4.
|
| 456 |
+
That number of bytes is discarded from the beginning of plaintext.
|
| 457 |
+
"""
|
| 458 |
+
|
| 459 |
+
key = _api.check_getitem({'eexec': 55665, 'charstring': 4330}, key=key)
|
| 460 |
+
plaintext = []
|
| 461 |
+
for byte in ciphertext:
|
| 462 |
+
plaintext.append(byte ^ (key >> 8))
|
| 463 |
+
key = ((key+byte) * 52845 + 22719) & 0xffff
|
| 464 |
+
|
| 465 |
+
return bytes(plaintext[ndiscard:])
|
| 466 |
+
|
| 467 |
+
@staticmethod
|
| 468 |
+
def _encrypt(plaintext, key, ndiscard=4):
|
| 469 |
+
"""
|
| 470 |
+
Encrypt plaintext using the Type-1 font algorithm.
|
| 471 |
+
|
| 472 |
+
The algorithm is described in Adobe's "Adobe Type 1 Font Format".
|
| 473 |
+
The key argument can be an integer, or one of the strings
|
| 474 |
+
'eexec' and 'charstring', which map to the key specified for the
|
| 475 |
+
corresponding part of Type-1 fonts.
|
| 476 |
+
|
| 477 |
+
The ndiscard argument should be an integer, usually 4. That
|
| 478 |
+
number of bytes is prepended to the plaintext before encryption.
|
| 479 |
+
This function prepends NUL bytes for reproducibility, even though
|
| 480 |
+
the original algorithm uses random bytes, presumably to avoid
|
| 481 |
+
cryptanalysis.
|
| 482 |
+
"""
|
| 483 |
+
|
| 484 |
+
key = _api.check_getitem({'eexec': 55665, 'charstring': 4330}, key=key)
|
| 485 |
+
ciphertext = []
|
| 486 |
+
for byte in b'\0' * ndiscard + plaintext:
|
| 487 |
+
c = byte ^ (key >> 8)
|
| 488 |
+
ciphertext.append(c)
|
| 489 |
+
key = ((key + c) * 52845 + 22719) & 0xffff
|
| 490 |
+
|
| 491 |
+
return bytes(ciphertext)
|
| 492 |
+
|
| 493 |
+
def _parse(self):
|
| 494 |
+
"""
|
| 495 |
+
Find the values of various font properties. This limited kind
|
| 496 |
+
of parsing is described in Chapter 10 "Adobe Type Manager
|
| 497 |
+
Compatibility" of the Type-1 spec.
|
| 498 |
+
"""
|
| 499 |
+
# Start with reasonable defaults
|
| 500 |
+
prop = {'Weight': 'Regular', 'ItalicAngle': 0.0, 'isFixedPitch': False,
|
| 501 |
+
'UnderlinePosition': -100, 'UnderlineThickness': 50}
|
| 502 |
+
pos = {}
|
| 503 |
+
data = self.parts[0] + self.decrypted
|
| 504 |
+
|
| 505 |
+
source = _tokenize(data, True)
|
| 506 |
+
while True:
|
| 507 |
+
# See if there is a key to be assigned a value
|
| 508 |
+
# e.g. /FontName in /FontName /Helvetica def
|
| 509 |
+
try:
|
| 510 |
+
token = next(source)
|
| 511 |
+
except StopIteration:
|
| 512 |
+
break
|
| 513 |
+
if token.is_delim():
|
| 514 |
+
# skip over this - we want top-level keys only
|
| 515 |
+
_expression(token, source, data)
|
| 516 |
+
if token.is_slash_name():
|
| 517 |
+
key = token.value()
|
| 518 |
+
keypos = token.pos
|
| 519 |
+
else:
|
| 520 |
+
continue
|
| 521 |
+
|
| 522 |
+
# Some values need special parsing
|
| 523 |
+
if key in ('Subrs', 'CharStrings', 'Encoding', 'OtherSubrs'):
|
| 524 |
+
prop[key], endpos = {
|
| 525 |
+
'Subrs': self._parse_subrs,
|
| 526 |
+
'CharStrings': self._parse_charstrings,
|
| 527 |
+
'Encoding': self._parse_encoding,
|
| 528 |
+
'OtherSubrs': self._parse_othersubrs
|
| 529 |
+
}[key](source, data)
|
| 530 |
+
pos.setdefault(key, []).append((keypos, endpos))
|
| 531 |
+
continue
|
| 532 |
+
|
| 533 |
+
try:
|
| 534 |
+
token = next(source)
|
| 535 |
+
except StopIteration:
|
| 536 |
+
break
|
| 537 |
+
|
| 538 |
+
if isinstance(token, _KeywordToken):
|
| 539 |
+
# constructs like
|
| 540 |
+
# FontDirectory /Helvetica known {...} {...} ifelse
|
| 541 |
+
# mean the key was not really a key
|
| 542 |
+
continue
|
| 543 |
+
|
| 544 |
+
if token.is_delim():
|
| 545 |
+
value = _expression(token, source, data).raw
|
| 546 |
+
else:
|
| 547 |
+
value = token.value()
|
| 548 |
+
|
| 549 |
+
# look for a 'def' possibly preceded by access modifiers
|
| 550 |
+
try:
|
| 551 |
+
kw = next(
|
| 552 |
+
kw for kw in source
|
| 553 |
+
if not kw.is_keyword('readonly', 'noaccess', 'executeonly')
|
| 554 |
+
)
|
| 555 |
+
except StopIteration:
|
| 556 |
+
break
|
| 557 |
+
|
| 558 |
+
# sometimes noaccess def and readonly def are abbreviated
|
| 559 |
+
if kw.is_keyword('def', self._abbr['ND'], self._abbr['NP']):
|
| 560 |
+
prop[key] = value
|
| 561 |
+
pos.setdefault(key, []).append((keypos, kw.endpos()))
|
| 562 |
+
|
| 563 |
+
# detect the standard abbreviations
|
| 564 |
+
if value == '{noaccess def}':
|
| 565 |
+
self._abbr['ND'] = key
|
| 566 |
+
elif value == '{noaccess put}':
|
| 567 |
+
self._abbr['NP'] = key
|
| 568 |
+
elif value == '{string currentfile exch readstring pop}':
|
| 569 |
+
self._abbr['RD'] = key
|
| 570 |
+
|
| 571 |
+
# Fill in the various *Name properties
|
| 572 |
+
if 'FontName' not in prop:
|
| 573 |
+
prop['FontName'] = (prop.get('FullName') or
|
| 574 |
+
prop.get('FamilyName') or
|
| 575 |
+
'Unknown')
|
| 576 |
+
if 'FullName' not in prop:
|
| 577 |
+
prop['FullName'] = prop['FontName']
|
| 578 |
+
if 'FamilyName' not in prop:
|
| 579 |
+
extras = ('(?i)([ -](regular|plain|italic|oblique|(semi)?bold|'
|
| 580 |
+
'(ultra)?light|extra|condensed))+$')
|
| 581 |
+
prop['FamilyName'] = re.sub(extras, '', prop['FullName'])
|
| 582 |
+
# Decrypt the encrypted parts
|
| 583 |
+
ndiscard = prop.get('lenIV', 4)
|
| 584 |
+
cs = prop['CharStrings']
|
| 585 |
+
for key, value in cs.items():
|
| 586 |
+
cs[key] = self._decrypt(value, 'charstring', ndiscard)
|
| 587 |
+
if 'Subrs' in prop:
|
| 588 |
+
prop['Subrs'] = [
|
| 589 |
+
self._decrypt(value, 'charstring', ndiscard)
|
| 590 |
+
for value in prop['Subrs']
|
| 591 |
+
]
|
| 592 |
+
|
| 593 |
+
self.prop = prop
|
| 594 |
+
self._pos = pos
|
| 595 |
+
|
| 596 |
+
def _parse_subrs(self, tokens, _data):
|
| 597 |
+
count_token = next(tokens)
|
| 598 |
+
if not count_token.is_number():
|
| 599 |
+
raise RuntimeError(
|
| 600 |
+
f"Token following /Subrs must be a number, was {count_token}"
|
| 601 |
+
)
|
| 602 |
+
count = count_token.value()
|
| 603 |
+
array = [None] * count
|
| 604 |
+
next(t for t in tokens if t.is_keyword('array'))
|
| 605 |
+
for _ in range(count):
|
| 606 |
+
next(t for t in tokens if t.is_keyword('dup'))
|
| 607 |
+
index_token = next(tokens)
|
| 608 |
+
if not index_token.is_number():
|
| 609 |
+
raise RuntimeError(
|
| 610 |
+
"Token following dup in Subrs definition must be a "
|
| 611 |
+
f"number, was {index_token}"
|
| 612 |
+
)
|
| 613 |
+
nbytes_token = next(tokens)
|
| 614 |
+
if not nbytes_token.is_number():
|
| 615 |
+
raise RuntimeError(
|
| 616 |
+
"Second token following dup in Subrs definition must "
|
| 617 |
+
f"be a number, was {nbytes_token}"
|
| 618 |
+
)
|
| 619 |
+
token = next(tokens)
|
| 620 |
+
if not token.is_keyword(self._abbr['RD']):
|
| 621 |
+
raise RuntimeError(
|
| 622 |
+
f"Token preceding subr must be {self._abbr['RD']}, "
|
| 623 |
+
f"was {token}"
|
| 624 |
+
)
|
| 625 |
+
binary_token = tokens.send(1+nbytes_token.value())
|
| 626 |
+
array[index_token.value()] = binary_token.value()
|
| 627 |
+
|
| 628 |
+
return array, next(tokens).endpos()
|
| 629 |
+
|
| 630 |
+
@staticmethod
|
| 631 |
+
def _parse_charstrings(tokens, _data):
|
| 632 |
+
count_token = next(tokens)
|
| 633 |
+
if not count_token.is_number():
|
| 634 |
+
raise RuntimeError(
|
| 635 |
+
"Token following /CharStrings must be a number, "
|
| 636 |
+
f"was {count_token}"
|
| 637 |
+
)
|
| 638 |
+
count = count_token.value()
|
| 639 |
+
charstrings = {}
|
| 640 |
+
next(t for t in tokens if t.is_keyword('begin'))
|
| 641 |
+
while True:
|
| 642 |
+
token = next(t for t in tokens
|
| 643 |
+
if t.is_keyword('end') or t.is_slash_name())
|
| 644 |
+
if token.raw == 'end':
|
| 645 |
+
return charstrings, token.endpos()
|
| 646 |
+
glyphname = token.value()
|
| 647 |
+
nbytes_token = next(tokens)
|
| 648 |
+
if not nbytes_token.is_number():
|
| 649 |
+
raise RuntimeError(
|
| 650 |
+
f"Token following /{glyphname} in CharStrings definition "
|
| 651 |
+
f"must be a number, was {nbytes_token}"
|
| 652 |
+
)
|
| 653 |
+
next(tokens) # usually RD or |-
|
| 654 |
+
binary_token = tokens.send(1+nbytes_token.value())
|
| 655 |
+
charstrings[glyphname] = binary_token.value()
|
| 656 |
+
|
| 657 |
+
@staticmethod
|
| 658 |
+
def _parse_encoding(tokens, _data):
|
| 659 |
+
# this only works for encodings that follow the Adobe manual
|
| 660 |
+
# but some old fonts include non-compliant data - we log a warning
|
| 661 |
+
# and return a possibly incomplete encoding
|
| 662 |
+
encoding = {}
|
| 663 |
+
while True:
|
| 664 |
+
token = next(t for t in tokens
|
| 665 |
+
if t.is_keyword('StandardEncoding', 'dup', 'def'))
|
| 666 |
+
if token.is_keyword('StandardEncoding'):
|
| 667 |
+
return _StandardEncoding, token.endpos()
|
| 668 |
+
if token.is_keyword('def'):
|
| 669 |
+
return encoding, token.endpos()
|
| 670 |
+
index_token = next(tokens)
|
| 671 |
+
if not index_token.is_number():
|
| 672 |
+
_log.warning(
|
| 673 |
+
f"Parsing encoding: expected number, got {index_token}"
|
| 674 |
+
)
|
| 675 |
+
continue
|
| 676 |
+
name_token = next(tokens)
|
| 677 |
+
if not name_token.is_slash_name():
|
| 678 |
+
_log.warning(
|
| 679 |
+
f"Parsing encoding: expected slash-name, got {name_token}"
|
| 680 |
+
)
|
| 681 |
+
continue
|
| 682 |
+
encoding[index_token.value()] = name_token.value()
|
| 683 |
+
|
| 684 |
+
@staticmethod
|
| 685 |
+
def _parse_othersubrs(tokens, data):
|
| 686 |
+
init_pos = None
|
| 687 |
+
while True:
|
| 688 |
+
token = next(tokens)
|
| 689 |
+
if init_pos is None:
|
| 690 |
+
init_pos = token.pos
|
| 691 |
+
if token.is_delim():
|
| 692 |
+
_expression(token, tokens, data)
|
| 693 |
+
elif token.is_keyword('def', 'ND', '|-'):
|
| 694 |
+
return data[init_pos:token.endpos()], token.endpos()
|
| 695 |
+
|
| 696 |
+
def transform(self, effects):
|
| 697 |
+
"""
|
| 698 |
+
Return a new font that is slanted and/or extended.
|
| 699 |
+
|
| 700 |
+
Parameters
|
| 701 |
+
----------
|
| 702 |
+
effects : dict
|
| 703 |
+
A dict with optional entries:
|
| 704 |
+
|
| 705 |
+
- 'slant' : float, default: 0
|
| 706 |
+
Tangent of the angle that the font is to be slanted to the
|
| 707 |
+
right. Negative values slant to the left.
|
| 708 |
+
- 'extend' : float, default: 1
|
| 709 |
+
Scaling factor for the font width. Values less than 1 condense
|
| 710 |
+
the glyphs.
|
| 711 |
+
|
| 712 |
+
Returns
|
| 713 |
+
-------
|
| 714 |
+
`Type1Font`
|
| 715 |
+
"""
|
| 716 |
+
fontname = self.prop['FontName']
|
| 717 |
+
italicangle = self.prop['ItalicAngle']
|
| 718 |
+
|
| 719 |
+
array = [
|
| 720 |
+
float(x) for x in (self.prop['FontMatrix']
|
| 721 |
+
.lstrip('[').rstrip(']').split())
|
| 722 |
+
]
|
| 723 |
+
oldmatrix = np.eye(3, 3)
|
| 724 |
+
oldmatrix[0:3, 0] = array[::2]
|
| 725 |
+
oldmatrix[0:3, 1] = array[1::2]
|
| 726 |
+
modifier = np.eye(3, 3)
|
| 727 |
+
|
| 728 |
+
if 'slant' in effects:
|
| 729 |
+
slant = effects['slant']
|
| 730 |
+
fontname += f'_Slant_{int(1000 * slant)}'
|
| 731 |
+
italicangle = round(
|
| 732 |
+
float(italicangle) - np.arctan(slant) / np.pi * 180,
|
| 733 |
+
5
|
| 734 |
+
)
|
| 735 |
+
modifier[1, 0] = slant
|
| 736 |
+
|
| 737 |
+
if 'extend' in effects:
|
| 738 |
+
extend = effects['extend']
|
| 739 |
+
fontname += f'_Extend_{int(1000 * extend)}'
|
| 740 |
+
modifier[0, 0] = extend
|
| 741 |
+
|
| 742 |
+
newmatrix = np.dot(modifier, oldmatrix)
|
| 743 |
+
array[::2] = newmatrix[0:3, 0]
|
| 744 |
+
array[1::2] = newmatrix[0:3, 1]
|
| 745 |
+
fontmatrix = (
|
| 746 |
+
f"[{' '.join(_format_approx(x, 6) for x in array)}]"
|
| 747 |
+
)
|
| 748 |
+
replacements = (
|
| 749 |
+
[(x, f'/FontName/{fontname} def')
|
| 750 |
+
for x in self._pos['FontName']]
|
| 751 |
+
+ [(x, f'/ItalicAngle {italicangle} def')
|
| 752 |
+
for x in self._pos['ItalicAngle']]
|
| 753 |
+
+ [(x, f'/FontMatrix {fontmatrix} readonly def')
|
| 754 |
+
for x in self._pos['FontMatrix']]
|
| 755 |
+
+ [(x, '') for x in self._pos.get('UniqueID', [])]
|
| 756 |
+
)
|
| 757 |
+
|
| 758 |
+
data = bytearray(self.parts[0])
|
| 759 |
+
data.extend(self.decrypted)
|
| 760 |
+
len0 = len(self.parts[0])
|
| 761 |
+
for (pos0, pos1), value in sorted(replacements, reverse=True):
|
| 762 |
+
data[pos0:pos1] = value.encode('ascii', 'replace')
|
| 763 |
+
if pos0 < len(self.parts[0]):
|
| 764 |
+
if pos1 >= len(self.parts[0]):
|
| 765 |
+
raise RuntimeError(
|
| 766 |
+
f"text to be replaced with {value} spans "
|
| 767 |
+
"the eexec boundary"
|
| 768 |
+
)
|
| 769 |
+
len0 += len(value) - pos1 + pos0
|
| 770 |
+
|
| 771 |
+
data = bytes(data)
|
| 772 |
+
return Type1Font((
|
| 773 |
+
data[:len0],
|
| 774 |
+
self._encrypt(data[len0:], 'eexec'),
|
| 775 |
+
self.parts[2]
|
| 776 |
+
))
|
| 777 |
+
|
| 778 |
+
|
| 779 |
+
_StandardEncoding = {
|
| 780 |
+
**{ord(letter): letter for letter in string.ascii_letters},
|
| 781 |
+
0: '.notdef',
|
| 782 |
+
32: 'space',
|
| 783 |
+
33: 'exclam',
|
| 784 |
+
34: 'quotedbl',
|
| 785 |
+
35: 'numbersign',
|
| 786 |
+
36: 'dollar',
|
| 787 |
+
37: 'percent',
|
| 788 |
+
38: 'ampersand',
|
| 789 |
+
39: 'quoteright',
|
| 790 |
+
40: 'parenleft',
|
| 791 |
+
41: 'parenright',
|
| 792 |
+
42: 'asterisk',
|
| 793 |
+
43: 'plus',
|
| 794 |
+
44: 'comma',
|
| 795 |
+
45: 'hyphen',
|
| 796 |
+
46: 'period',
|
| 797 |
+
47: 'slash',
|
| 798 |
+
48: 'zero',
|
| 799 |
+
49: 'one',
|
| 800 |
+
50: 'two',
|
| 801 |
+
51: 'three',
|
| 802 |
+
52: 'four',
|
| 803 |
+
53: 'five',
|
| 804 |
+
54: 'six',
|
| 805 |
+
55: 'seven',
|
| 806 |
+
56: 'eight',
|
| 807 |
+
57: 'nine',
|
| 808 |
+
58: 'colon',
|
| 809 |
+
59: 'semicolon',
|
| 810 |
+
60: 'less',
|
| 811 |
+
61: 'equal',
|
| 812 |
+
62: 'greater',
|
| 813 |
+
63: 'question',
|
| 814 |
+
64: 'at',
|
| 815 |
+
91: 'bracketleft',
|
| 816 |
+
92: 'backslash',
|
| 817 |
+
93: 'bracketright',
|
| 818 |
+
94: 'asciicircum',
|
| 819 |
+
95: 'underscore',
|
| 820 |
+
96: 'quoteleft',
|
| 821 |
+
123: 'braceleft',
|
| 822 |
+
124: 'bar',
|
| 823 |
+
125: 'braceright',
|
| 824 |
+
126: 'asciitilde',
|
| 825 |
+
161: 'exclamdown',
|
| 826 |
+
162: 'cent',
|
| 827 |
+
163: 'sterling',
|
| 828 |
+
164: 'fraction',
|
| 829 |
+
165: 'yen',
|
| 830 |
+
166: 'florin',
|
| 831 |
+
167: 'section',
|
| 832 |
+
168: 'currency',
|
| 833 |
+
169: 'quotesingle',
|
| 834 |
+
170: 'quotedblleft',
|
| 835 |
+
171: 'guillemotleft',
|
| 836 |
+
172: 'guilsinglleft',
|
| 837 |
+
173: 'guilsinglright',
|
| 838 |
+
174: 'fi',
|
| 839 |
+
175: 'fl',
|
| 840 |
+
177: 'endash',
|
| 841 |
+
178: 'dagger',
|
| 842 |
+
179: 'daggerdbl',
|
| 843 |
+
180: 'periodcentered',
|
| 844 |
+
182: 'paragraph',
|
| 845 |
+
183: 'bullet',
|
| 846 |
+
184: 'quotesinglbase',
|
| 847 |
+
185: 'quotedblbase',
|
| 848 |
+
186: 'quotedblright',
|
| 849 |
+
187: 'guillemotright',
|
| 850 |
+
188: 'ellipsis',
|
| 851 |
+
189: 'perthousand',
|
| 852 |
+
191: 'questiondown',
|
| 853 |
+
193: 'grave',
|
| 854 |
+
194: 'acute',
|
| 855 |
+
195: 'circumflex',
|
| 856 |
+
196: 'tilde',
|
| 857 |
+
197: 'macron',
|
| 858 |
+
198: 'breve',
|
| 859 |
+
199: 'dotaccent',
|
| 860 |
+
200: 'dieresis',
|
| 861 |
+
202: 'ring',
|
| 862 |
+
203: 'cedilla',
|
| 863 |
+
205: 'hungarumlaut',
|
| 864 |
+
206: 'ogonek',
|
| 865 |
+
207: 'caron',
|
| 866 |
+
208: 'emdash',
|
| 867 |
+
225: 'AE',
|
| 868 |
+
227: 'ordfeminine',
|
| 869 |
+
232: 'Lslash',
|
| 870 |
+
233: 'Oslash',
|
| 871 |
+
234: 'OE',
|
| 872 |
+
235: 'ordmasculine',
|
| 873 |
+
241: 'ae',
|
| 874 |
+
245: 'dotlessi',
|
| 875 |
+
248: 'lslash',
|
| 876 |
+
249: 'oslash',
|
| 877 |
+
250: 'oe',
|
| 878 |
+
251: 'germandbls',
|
| 879 |
+
}
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matpl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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import abc
|
| 2 |
+
import base64
|
| 3 |
+
import contextlib
|
| 4 |
+
from io import BytesIO, TextIOWrapper
|
| 5 |
+
import itertools
|
| 6 |
+
import logging
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import shutil
|
| 9 |
+
import subprocess
|
| 10 |
+
import sys
|
| 11 |
+
from tempfile import TemporaryDirectory
|
| 12 |
+
import uuid
|
| 13 |
+
import warnings
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
from PIL import Image
|
| 17 |
+
|
| 18 |
+
import matplotlib as mpl
|
| 19 |
+
from matplotlib._animation_data import (
|
| 20 |
+
DISPLAY_TEMPLATE, INCLUDED_FRAMES, JS_INCLUDE, STYLE_INCLUDE)
|
| 21 |
+
from matplotlib import _api, cbook
|
| 22 |
+
import matplotlib.colors as mcolors
|
| 23 |
+
|
| 24 |
+
_log = logging.getLogger(__name__)
|
| 25 |
+
|
| 26 |
+
# Process creation flag for subprocess to prevent it raising a terminal
|
| 27 |
+
# window. See for example https://stackoverflow.com/q/24130623/
|
| 28 |
+
subprocess_creation_flags = (
|
| 29 |
+
subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def adjusted_figsize(w, h, dpi, n):
|
| 33 |
+
"""
|
| 34 |
+
Compute figure size so that pixels are a multiple of n.
|
| 35 |
+
|
| 36 |
+
Parameters
|
| 37 |
+
----------
|
| 38 |
+
w, h : float
|
| 39 |
+
Size in inches.
|
| 40 |
+
|
| 41 |
+
dpi : float
|
| 42 |
+
The dpi.
|
| 43 |
+
|
| 44 |
+
n : int
|
| 45 |
+
The target multiple.
|
| 46 |
+
|
| 47 |
+
Returns
|
| 48 |
+
-------
|
| 49 |
+
wnew, hnew : float
|
| 50 |
+
The new figure size in inches.
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
# this maybe simplified if / when we adopt consistent rounding for
|
| 54 |
+
# pixel size across the whole library
|
| 55 |
+
def correct_roundoff(x, dpi, n):
|
| 56 |
+
if int(x*dpi) % n != 0:
|
| 57 |
+
if int(np.nextafter(x, np.inf)*dpi) % n == 0:
|
| 58 |
+
x = np.nextafter(x, np.inf)
|
| 59 |
+
elif int(np.nextafter(x, -np.inf)*dpi) % n == 0:
|
| 60 |
+
x = np.nextafter(x, -np.inf)
|
| 61 |
+
return x
|
| 62 |
+
|
| 63 |
+
wnew = int(w * dpi / n) * n / dpi
|
| 64 |
+
hnew = int(h * dpi / n) * n / dpi
|
| 65 |
+
return correct_roundoff(wnew, dpi, n), correct_roundoff(hnew, dpi, n)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class MovieWriterRegistry:
|
| 69 |
+
"""Registry of available writer classes by human readable name."""
|
| 70 |
+
|
| 71 |
+
def __init__(self):
|
| 72 |
+
self._registered = dict()
|
| 73 |
+
|
| 74 |
+
def register(self, name):
|
| 75 |
+
"""
|
| 76 |
+
Decorator for registering a class under a name.
|
| 77 |
+
|
| 78 |
+
Example use::
|
| 79 |
+
|
| 80 |
+
@registry.register(name)
|
| 81 |
+
class Foo:
|
| 82 |
+
pass
|
| 83 |
+
"""
|
| 84 |
+
def wrapper(writer_cls):
|
| 85 |
+
self._registered[name] = writer_cls
|
| 86 |
+
return writer_cls
|
| 87 |
+
return wrapper
|
| 88 |
+
|
| 89 |
+
def is_available(self, name):
|
| 90 |
+
"""
|
| 91 |
+
Check if given writer is available by name.
|
| 92 |
+
|
| 93 |
+
Parameters
|
| 94 |
+
----------
|
| 95 |
+
name : str
|
| 96 |
+
|
| 97 |
+
Returns
|
| 98 |
+
-------
|
| 99 |
+
bool
|
| 100 |
+
"""
|
| 101 |
+
try:
|
| 102 |
+
cls = self._registered[name]
|
| 103 |
+
except KeyError:
|
| 104 |
+
return False
|
| 105 |
+
return cls.isAvailable()
|
| 106 |
+
|
| 107 |
+
def __iter__(self):
|
| 108 |
+
"""Iterate over names of available writer class."""
|
| 109 |
+
for name in self._registered:
|
| 110 |
+
if self.is_available(name):
|
| 111 |
+
yield name
|
| 112 |
+
|
| 113 |
+
def list(self):
|
| 114 |
+
"""Get a list of available MovieWriters."""
|
| 115 |
+
return [*self]
|
| 116 |
+
|
| 117 |
+
def __getitem__(self, name):
|
| 118 |
+
"""Get an available writer class from its name."""
|
| 119 |
+
if self.is_available(name):
|
| 120 |
+
return self._registered[name]
|
| 121 |
+
raise RuntimeError(f"Requested MovieWriter ({name}) not available")
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
writers = MovieWriterRegistry()
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
class AbstractMovieWriter(abc.ABC):
|
| 128 |
+
"""
|
| 129 |
+
Abstract base class for writing movies, providing a way to grab frames by
|
| 130 |
+
calling `~AbstractMovieWriter.grab_frame`.
|
| 131 |
+
|
| 132 |
+
`setup` is called to start the process and `finish` is called afterwards.
|
| 133 |
+
`saving` is provided as a context manager to facilitate this process as ::
|
| 134 |
+
|
| 135 |
+
with moviewriter.saving(fig, outfile='myfile.mp4', dpi=100):
|
| 136 |
+
# Iterate over frames
|
| 137 |
+
moviewriter.grab_frame(**savefig_kwargs)
|
| 138 |
+
|
| 139 |
+
The use of the context manager ensures that `setup` and `finish` are
|
| 140 |
+
performed as necessary.
|
| 141 |
+
|
| 142 |
+
An instance of a concrete subclass of this class can be given as the
|
| 143 |
+
``writer`` argument of `Animation.save()`.
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
def __init__(self, fps=5, metadata=None, codec=None, bitrate=None):
|
| 147 |
+
self.fps = fps
|
| 148 |
+
self.metadata = metadata if metadata is not None else {}
|
| 149 |
+
self.codec = mpl._val_or_rc(codec, 'animation.codec')
|
| 150 |
+
self.bitrate = mpl._val_or_rc(bitrate, 'animation.bitrate')
|
| 151 |
+
|
| 152 |
+
@abc.abstractmethod
|
| 153 |
+
def setup(self, fig, outfile, dpi=None):
|
| 154 |
+
"""
|
| 155 |
+
Setup for writing the movie file.
|
| 156 |
+
|
| 157 |
+
Parameters
|
| 158 |
+
----------
|
| 159 |
+
fig : `~matplotlib.figure.Figure`
|
| 160 |
+
The figure object that contains the information for frames.
|
| 161 |
+
outfile : str
|
| 162 |
+
The filename of the resulting movie file.
|
| 163 |
+
dpi : float, default: ``fig.dpi``
|
| 164 |
+
The DPI (or resolution) for the file. This controls the size
|
| 165 |
+
in pixels of the resulting movie file.
|
| 166 |
+
"""
|
| 167 |
+
# Check that path is valid
|
| 168 |
+
Path(outfile).parent.resolve(strict=True)
|
| 169 |
+
self.outfile = outfile
|
| 170 |
+
self.fig = fig
|
| 171 |
+
if dpi is None:
|
| 172 |
+
dpi = self.fig.dpi
|
| 173 |
+
self.dpi = dpi
|
| 174 |
+
|
| 175 |
+
@property
|
| 176 |
+
def frame_size(self):
|
| 177 |
+
"""A tuple ``(width, height)`` in pixels of a movie frame."""
|
| 178 |
+
w, h = self.fig.get_size_inches()
|
| 179 |
+
return int(w * self.dpi), int(h * self.dpi)
|
| 180 |
+
|
| 181 |
+
def _supports_transparency(self):
|
| 182 |
+
"""
|
| 183 |
+
Whether this writer supports transparency.
|
| 184 |
+
|
| 185 |
+
Writers may consult output file type and codec to determine this at runtime.
|
| 186 |
+
"""
|
| 187 |
+
return False
|
| 188 |
+
|
| 189 |
+
@abc.abstractmethod
|
| 190 |
+
def grab_frame(self, **savefig_kwargs):
|
| 191 |
+
"""
|
| 192 |
+
Grab the image information from the figure and save as a movie frame.
|
| 193 |
+
|
| 194 |
+
All keyword arguments in *savefig_kwargs* are passed on to the
|
| 195 |
+
`~.Figure.savefig` call that saves the figure. However, several
|
| 196 |
+
keyword arguments that are supported by `~.Figure.savefig` may not be
|
| 197 |
+
passed as they are controlled by the MovieWriter:
|
| 198 |
+
|
| 199 |
+
- *dpi*, *bbox_inches*: These may not be passed because each frame of the
|
| 200 |
+
animation much be exactly the same size in pixels.
|
| 201 |
+
- *format*: This is controlled by the MovieWriter.
|
| 202 |
+
"""
|
| 203 |
+
|
| 204 |
+
@abc.abstractmethod
|
| 205 |
+
def finish(self):
|
| 206 |
+
"""Finish any processing for writing the movie."""
|
| 207 |
+
|
| 208 |
+
@contextlib.contextmanager
|
| 209 |
+
def saving(self, fig, outfile, dpi, *args, **kwargs):
|
| 210 |
+
"""
|
| 211 |
+
Context manager to facilitate writing the movie file.
|
| 212 |
+
|
| 213 |
+
``*args, **kw`` are any parameters that should be passed to `setup`.
|
| 214 |
+
"""
|
| 215 |
+
if mpl.rcParams['savefig.bbox'] == 'tight':
|
| 216 |
+
_log.info("Disabling savefig.bbox = 'tight', as it may cause "
|
| 217 |
+
"frame size to vary, which is inappropriate for "
|
| 218 |
+
"animation.")
|
| 219 |
+
|
| 220 |
+
# This particular sequence is what contextlib.contextmanager wants
|
| 221 |
+
self.setup(fig, outfile, dpi, *args, **kwargs)
|
| 222 |
+
with mpl.rc_context({'savefig.bbox': None}):
|
| 223 |
+
try:
|
| 224 |
+
yield self
|
| 225 |
+
finally:
|
| 226 |
+
self.finish()
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
class MovieWriter(AbstractMovieWriter):
|
| 230 |
+
"""
|
| 231 |
+
Base class for writing movies.
|
| 232 |
+
|
| 233 |
+
This is a base class for MovieWriter subclasses that write a movie frame
|
| 234 |
+
data to a pipe. You cannot instantiate this class directly.
|
| 235 |
+
See examples for how to use its subclasses.
|
| 236 |
+
|
| 237 |
+
Attributes
|
| 238 |
+
----------
|
| 239 |
+
frame_format : str
|
| 240 |
+
The format used in writing frame data, defaults to 'rgba'.
|
| 241 |
+
fig : `~matplotlib.figure.Figure`
|
| 242 |
+
The figure to capture data from.
|
| 243 |
+
This must be provided by the subclasses.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
# Builtin writer subclasses additionally define the _exec_key and _args_key
|
| 247 |
+
# attributes, which indicate the rcParams entries where the path to the
|
| 248 |
+
# executable and additional command-line arguments to the executable are
|
| 249 |
+
# stored. Third-party writers cannot meaningfully set these as they cannot
|
| 250 |
+
# extend rcParams with new keys.
|
| 251 |
+
|
| 252 |
+
# Pipe-based writers only support RGBA, but file-based ones support more
|
| 253 |
+
# formats.
|
| 254 |
+
supported_formats = ["rgba"]
|
| 255 |
+
|
| 256 |
+
def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
|
| 257 |
+
metadata=None):
|
| 258 |
+
"""
|
| 259 |
+
Parameters
|
| 260 |
+
----------
|
| 261 |
+
fps : int, default: 5
|
| 262 |
+
Movie frame rate (per second).
|
| 263 |
+
codec : str or None, default: :rc:`animation.codec`
|
| 264 |
+
The codec to use.
|
| 265 |
+
bitrate : int, default: :rc:`animation.bitrate`
|
| 266 |
+
The bitrate of the movie, in kilobits per second. Higher values
|
| 267 |
+
means higher quality movies, but increase the file size. A value
|
| 268 |
+
of -1 lets the underlying movie encoder select the bitrate.
|
| 269 |
+
extra_args : list of str or None, optional
|
| 270 |
+
Extra command-line arguments passed to the underlying movie encoder. These
|
| 271 |
+
arguments are passed last to the encoder, just before the filename. The
|
| 272 |
+
default, None, means to use :rc:`animation.[name-of-encoder]_args` for the
|
| 273 |
+
builtin writers.
|
| 274 |
+
metadata : dict[str, str], default: {}
|
| 275 |
+
A dictionary of keys and values for metadata to include in the
|
| 276 |
+
output file. Some keys that may be of use include:
|
| 277 |
+
title, artist, genre, subject, copyright, srcform, comment.
|
| 278 |
+
"""
|
| 279 |
+
if type(self) is MovieWriter:
|
| 280 |
+
# TODO MovieWriter is still an abstract class and needs to be
|
| 281 |
+
# extended with a mixin. This should be clearer in naming
|
| 282 |
+
# and description. For now, just give a reasonable error
|
| 283 |
+
# message to users.
|
| 284 |
+
raise TypeError(
|
| 285 |
+
'MovieWriter cannot be instantiated directly. Please use one '
|
| 286 |
+
'of its subclasses.')
|
| 287 |
+
|
| 288 |
+
super().__init__(fps=fps, metadata=metadata, codec=codec,
|
| 289 |
+
bitrate=bitrate)
|
| 290 |
+
self.frame_format = self.supported_formats[0]
|
| 291 |
+
self.extra_args = extra_args
|
| 292 |
+
|
| 293 |
+
def _adjust_frame_size(self):
|
| 294 |
+
if self.codec == 'h264':
|
| 295 |
+
wo, ho = self.fig.get_size_inches()
|
| 296 |
+
w, h = adjusted_figsize(wo, ho, self.dpi, 2)
|
| 297 |
+
if (wo, ho) != (w, h):
|
| 298 |
+
self.fig.set_size_inches(w, h, forward=True)
|
| 299 |
+
_log.info('figure size in inches has been adjusted '
|
| 300 |
+
'from %s x %s to %s x %s', wo, ho, w, h)
|
| 301 |
+
else:
|
| 302 |
+
w, h = self.fig.get_size_inches()
|
| 303 |
+
_log.debug('frame size in pixels is %s x %s', *self.frame_size)
|
| 304 |
+
return w, h
|
| 305 |
+
|
| 306 |
+
def setup(self, fig, outfile, dpi=None):
|
| 307 |
+
# docstring inherited
|
| 308 |
+
super().setup(fig, outfile, dpi=dpi)
|
| 309 |
+
self._w, self._h = self._adjust_frame_size()
|
| 310 |
+
# Run here so that grab_frame() can write the data to a pipe. This
|
| 311 |
+
# eliminates the need for temp files.
|
| 312 |
+
self._run()
|
| 313 |
+
|
| 314 |
+
def _run(self):
|
| 315 |
+
# Uses subprocess to call the program for assembling frames into a
|
| 316 |
+
# movie file. *args* returns the sequence of command line arguments
|
| 317 |
+
# from a few configuration options.
|
| 318 |
+
command = self._args()
|
| 319 |
+
_log.info('MovieWriter._run: running command: %s',
|
| 320 |
+
cbook._pformat_subprocess(command))
|
| 321 |
+
PIPE = subprocess.PIPE
|
| 322 |
+
self._proc = subprocess.Popen(
|
| 323 |
+
command, stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
| 324 |
+
creationflags=subprocess_creation_flags)
|
| 325 |
+
|
| 326 |
+
def finish(self):
|
| 327 |
+
"""Finish any processing for writing the movie."""
|
| 328 |
+
out, err = self._proc.communicate()
|
| 329 |
+
# Use the encoding/errors that universal_newlines would use.
|
| 330 |
+
out = TextIOWrapper(BytesIO(out)).read()
|
| 331 |
+
err = TextIOWrapper(BytesIO(err)).read()
|
| 332 |
+
if out:
|
| 333 |
+
_log.log(
|
| 334 |
+
logging.WARNING if self._proc.returncode else logging.DEBUG,
|
| 335 |
+
"MovieWriter stdout:\n%s", out)
|
| 336 |
+
if err:
|
| 337 |
+
_log.log(
|
| 338 |
+
logging.WARNING if self._proc.returncode else logging.DEBUG,
|
| 339 |
+
"MovieWriter stderr:\n%s", err)
|
| 340 |
+
if self._proc.returncode:
|
| 341 |
+
raise subprocess.CalledProcessError(
|
| 342 |
+
self._proc.returncode, self._proc.args, out, err)
|
| 343 |
+
|
| 344 |
+
def grab_frame(self, **savefig_kwargs):
|
| 345 |
+
# docstring inherited
|
| 346 |
+
_validate_grabframe_kwargs(savefig_kwargs)
|
| 347 |
+
_log.debug('MovieWriter.grab_frame: Grabbing frame.')
|
| 348 |
+
# Readjust the figure size in case it has been changed by the user.
|
| 349 |
+
# All frames must have the same size to save the movie correctly.
|
| 350 |
+
self.fig.set_size_inches(self._w, self._h)
|
| 351 |
+
# Save the figure data to the sink, using the frame format and dpi.
|
| 352 |
+
self.fig.savefig(self._proc.stdin, format=self.frame_format,
|
| 353 |
+
dpi=self.dpi, **savefig_kwargs)
|
| 354 |
+
|
| 355 |
+
def _args(self):
|
| 356 |
+
"""Assemble list of encoder-specific command-line arguments."""
|
| 357 |
+
return NotImplementedError("args needs to be implemented by subclass.")
|
| 358 |
+
|
| 359 |
+
@classmethod
|
| 360 |
+
def bin_path(cls):
|
| 361 |
+
"""
|
| 362 |
+
Return the binary path to the commandline tool used by a specific
|
| 363 |
+
subclass. This is a class method so that the tool can be looked for
|
| 364 |
+
before making a particular MovieWriter subclass available.
|
| 365 |
+
"""
|
| 366 |
+
return str(mpl.rcParams[cls._exec_key])
|
| 367 |
+
|
| 368 |
+
@classmethod
|
| 369 |
+
def isAvailable(cls):
|
| 370 |
+
"""Return whether a MovieWriter subclass is actually available."""
|
| 371 |
+
return shutil.which(cls.bin_path()) is not None
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
class FileMovieWriter(MovieWriter):
|
| 375 |
+
"""
|
| 376 |
+
`MovieWriter` for writing to individual files and stitching at the end.
|
| 377 |
+
|
| 378 |
+
This must be sub-classed to be useful.
|
| 379 |
+
"""
|
| 380 |
+
def __init__(self, *args, **kwargs):
|
| 381 |
+
super().__init__(*args, **kwargs)
|
| 382 |
+
self.frame_format = mpl.rcParams['animation.frame_format']
|
| 383 |
+
|
| 384 |
+
def setup(self, fig, outfile, dpi=None, frame_prefix=None):
|
| 385 |
+
"""
|
| 386 |
+
Setup for writing the movie file.
|
| 387 |
+
|
| 388 |
+
Parameters
|
| 389 |
+
----------
|
| 390 |
+
fig : `~matplotlib.figure.Figure`
|
| 391 |
+
The figure to grab the rendered frames from.
|
| 392 |
+
outfile : str
|
| 393 |
+
The filename of the resulting movie file.
|
| 394 |
+
dpi : float, default: ``fig.dpi``
|
| 395 |
+
The dpi of the output file. This, with the figure size,
|
| 396 |
+
controls the size in pixels of the resulting movie file.
|
| 397 |
+
frame_prefix : str, optional
|
| 398 |
+
The filename prefix to use for temporary files. If *None* (the
|
| 399 |
+
default), files are written to a temporary directory which is
|
| 400 |
+
deleted by `finish`; if not *None*, no temporary files are
|
| 401 |
+
deleted.
|
| 402 |
+
"""
|
| 403 |
+
# Check that path is valid
|
| 404 |
+
Path(outfile).parent.resolve(strict=True)
|
| 405 |
+
self.fig = fig
|
| 406 |
+
self.outfile = outfile
|
| 407 |
+
if dpi is None:
|
| 408 |
+
dpi = self.fig.dpi
|
| 409 |
+
self.dpi = dpi
|
| 410 |
+
self._adjust_frame_size()
|
| 411 |
+
|
| 412 |
+
if frame_prefix is None:
|
| 413 |
+
self._tmpdir = TemporaryDirectory()
|
| 414 |
+
self.temp_prefix = str(Path(self._tmpdir.name, 'tmp'))
|
| 415 |
+
else:
|
| 416 |
+
self._tmpdir = None
|
| 417 |
+
self.temp_prefix = frame_prefix
|
| 418 |
+
self._frame_counter = 0 # used for generating sequential file names
|
| 419 |
+
self._temp_paths = list()
|
| 420 |
+
self.fname_format_str = '%s%%07d.%s'
|
| 421 |
+
|
| 422 |
+
def __del__(self):
|
| 423 |
+
if hasattr(self, '_tmpdir') and self._tmpdir:
|
| 424 |
+
self._tmpdir.cleanup()
|
| 425 |
+
|
| 426 |
+
@property
|
| 427 |
+
def frame_format(self):
|
| 428 |
+
"""
|
| 429 |
+
Format (png, jpeg, etc.) to use for saving the frames, which can be
|
| 430 |
+
decided by the individual subclasses.
|
| 431 |
+
"""
|
| 432 |
+
return self._frame_format
|
| 433 |
+
|
| 434 |
+
@frame_format.setter
|
| 435 |
+
def frame_format(self, frame_format):
|
| 436 |
+
if frame_format in self.supported_formats:
|
| 437 |
+
self._frame_format = frame_format
|
| 438 |
+
else:
|
| 439 |
+
_api.warn_external(
|
| 440 |
+
f"Ignoring file format {frame_format!r} which is not "
|
| 441 |
+
f"supported by {type(self).__name__}; using "
|
| 442 |
+
f"{self.supported_formats[0]} instead.")
|
| 443 |
+
self._frame_format = self.supported_formats[0]
|
| 444 |
+
|
| 445 |
+
def _base_temp_name(self):
|
| 446 |
+
# Generates a template name (without number) given the frame format
|
| 447 |
+
# for extension and the prefix.
|
| 448 |
+
return self.fname_format_str % (self.temp_prefix, self.frame_format)
|
| 449 |
+
|
| 450 |
+
def grab_frame(self, **savefig_kwargs):
|
| 451 |
+
# docstring inherited
|
| 452 |
+
# Creates a filename for saving using basename and counter.
|
| 453 |
+
_validate_grabframe_kwargs(savefig_kwargs)
|
| 454 |
+
path = Path(self._base_temp_name() % self._frame_counter)
|
| 455 |
+
self._temp_paths.append(path) # Record the filename for later use.
|
| 456 |
+
self._frame_counter += 1 # Ensures each created name is unique.
|
| 457 |
+
_log.debug('FileMovieWriter.grab_frame: Grabbing frame %d to path=%s',
|
| 458 |
+
self._frame_counter, path)
|
| 459 |
+
with open(path, 'wb') as sink: # Save figure to the sink.
|
| 460 |
+
self.fig.savefig(sink, format=self.frame_format, dpi=self.dpi,
|
| 461 |
+
**savefig_kwargs)
|
| 462 |
+
|
| 463 |
+
def finish(self):
|
| 464 |
+
# Call run here now that all frame grabbing is done. All temp files
|
| 465 |
+
# are available to be assembled.
|
| 466 |
+
try:
|
| 467 |
+
self._run()
|
| 468 |
+
super().finish()
|
| 469 |
+
finally:
|
| 470 |
+
if self._tmpdir:
|
| 471 |
+
_log.debug(
|
| 472 |
+
'MovieWriter: clearing temporary path=%s', self._tmpdir
|
| 473 |
+
)
|
| 474 |
+
self._tmpdir.cleanup()
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
@writers.register('pillow')
|
| 478 |
+
class PillowWriter(AbstractMovieWriter):
|
| 479 |
+
def _supports_transparency(self):
|
| 480 |
+
return True
|
| 481 |
+
|
| 482 |
+
@classmethod
|
| 483 |
+
def isAvailable(cls):
|
| 484 |
+
return True
|
| 485 |
+
|
| 486 |
+
def setup(self, fig, outfile, dpi=None):
|
| 487 |
+
super().setup(fig, outfile, dpi=dpi)
|
| 488 |
+
self._frames = []
|
| 489 |
+
|
| 490 |
+
def grab_frame(self, **savefig_kwargs):
|
| 491 |
+
_validate_grabframe_kwargs(savefig_kwargs)
|
| 492 |
+
buf = BytesIO()
|
| 493 |
+
self.fig.savefig(
|
| 494 |
+
buf, **{**savefig_kwargs, "format": "rgba", "dpi": self.dpi})
|
| 495 |
+
im = Image.frombuffer(
|
| 496 |
+
"RGBA", self.frame_size, buf.getbuffer(), "raw", "RGBA", 0, 1)
|
| 497 |
+
if im.getextrema()[3][0] < 255:
|
| 498 |
+
# This frame has transparency, so we'll just add it as is.
|
| 499 |
+
self._frames.append(im)
|
| 500 |
+
else:
|
| 501 |
+
# Without transparency, we switch to RGB mode, which converts to P mode a
|
| 502 |
+
# little better if needed (specifically, this helps with GIF output.)
|
| 503 |
+
self._frames.append(im.convert("RGB"))
|
| 504 |
+
|
| 505 |
+
def finish(self):
|
| 506 |
+
self._frames[0].save(
|
| 507 |
+
self.outfile, save_all=True, append_images=self._frames[1:],
|
| 508 |
+
duration=int(1000 / self.fps), loop=0)
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
# Base class of ffmpeg information. Has the config keys and the common set
|
| 512 |
+
# of arguments that controls the *output* side of things.
|
| 513 |
+
class FFMpegBase:
|
| 514 |
+
"""
|
| 515 |
+
Mixin class for FFMpeg output.
|
| 516 |
+
|
| 517 |
+
This is a base class for the concrete `FFMpegWriter` and `FFMpegFileWriter`
|
| 518 |
+
classes.
|
| 519 |
+
"""
|
| 520 |
+
|
| 521 |
+
_exec_key = 'animation.ffmpeg_path'
|
| 522 |
+
_args_key = 'animation.ffmpeg_args'
|
| 523 |
+
|
| 524 |
+
def _supports_transparency(self):
|
| 525 |
+
suffix = Path(self.outfile).suffix
|
| 526 |
+
if suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}:
|
| 527 |
+
return True
|
| 528 |
+
# This list was found by going through `ffmpeg -codecs` for video encoders,
|
| 529 |
+
# running them with _support_transparency() forced to True, and checking that
|
| 530 |
+
# the "Pixel format" in Kdenlive included alpha. Note this is not a guarantee
|
| 531 |
+
# that transparency will work; you may also need to pass `-pix_fmt`, but we
|
| 532 |
+
# trust the user has done so if they are asking for these formats.
|
| 533 |
+
return self.codec in {
|
| 534 |
+
'apng', 'avrp', 'bmp', 'cfhd', 'dpx', 'ffv1', 'ffvhuff', 'gif', 'huffyuv',
|
| 535 |
+
'jpeg2000', 'ljpeg', 'png', 'prores', 'prores_aw', 'prores_ks', 'qtrle',
|
| 536 |
+
'rawvideo', 'targa', 'tiff', 'utvideo', 'v408', }
|
| 537 |
+
|
| 538 |
+
@property
|
| 539 |
+
def output_args(self):
|
| 540 |
+
args = []
|
| 541 |
+
suffix = Path(self.outfile).suffix
|
| 542 |
+
if suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}:
|
| 543 |
+
self.codec = suffix[1:]
|
| 544 |
+
else:
|
| 545 |
+
args.extend(['-vcodec', self.codec])
|
| 546 |
+
extra_args = (self.extra_args if self.extra_args is not None
|
| 547 |
+
else mpl.rcParams[self._args_key])
|
| 548 |
+
# For h264, the default format is yuv444p, which is not compatible
|
| 549 |
+
# with quicktime (and others). Specifying yuv420p fixes playback on
|
| 550 |
+
# iOS, as well as HTML5 video in firefox and safari (on both Windows and
|
| 551 |
+
# macOS). Also fixes internet explorer. This is as of 2015/10/29.
|
| 552 |
+
if self.codec == 'h264' and '-pix_fmt' not in extra_args:
|
| 553 |
+
args.extend(['-pix_fmt', 'yuv420p'])
|
| 554 |
+
# For GIF, we're telling FFmpeg to split the video stream, to generate
|
| 555 |
+
# a palette, and then use it for encoding.
|
| 556 |
+
elif self.codec == 'gif' and '-filter_complex' not in extra_args:
|
| 557 |
+
args.extend(['-filter_complex',
|
| 558 |
+
'split [a][b];[a] palettegen [p];[b][p] paletteuse'])
|
| 559 |
+
# For AVIF, we're telling FFmpeg to split the video stream, extract the alpha,
|
| 560 |
+
# in order to place it in a secondary stream, as needed by AVIF-in-FFmpeg.
|
| 561 |
+
elif self.codec == 'avif' and '-filter_complex' not in extra_args:
|
| 562 |
+
args.extend(['-filter_complex',
|
| 563 |
+
'split [rgb][rgba]; [rgba] alphaextract [alpha]',
|
| 564 |
+
'-map', '[rgb]', '-map', '[alpha]'])
|
| 565 |
+
if self.bitrate > 0:
|
| 566 |
+
args.extend(['-b', '%dk' % self.bitrate]) # %dk: bitrate in kbps.
|
| 567 |
+
for k, v in self.metadata.items():
|
| 568 |
+
args.extend(['-metadata', f'{k}={v}'])
|
| 569 |
+
args.extend(extra_args)
|
| 570 |
+
|
| 571 |
+
return args + ['-y', self.outfile]
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
# Combine FFMpeg options with pipe-based writing
|
| 575 |
+
@writers.register('ffmpeg')
|
| 576 |
+
class FFMpegWriter(FFMpegBase, MovieWriter):
|
| 577 |
+
"""
|
| 578 |
+
Pipe-based ffmpeg writer.
|
| 579 |
+
|
| 580 |
+
Frames are streamed directly to ffmpeg via a pipe and written in a single pass.
|
| 581 |
+
|
| 582 |
+
This effectively works as a slideshow input to ffmpeg with the fps passed as
|
| 583 |
+
``-framerate``, so see also `their notes on frame rates`_ for further details.
|
| 584 |
+
|
| 585 |
+
.. _their notes on frame rates: https://trac.ffmpeg.org/wiki/Slideshow#Framerates
|
| 586 |
+
"""
|
| 587 |
+
def _args(self):
|
| 588 |
+
# Returns the command line parameters for subprocess to use
|
| 589 |
+
# ffmpeg to create a movie using a pipe.
|
| 590 |
+
args = [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo',
|
| 591 |
+
'-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format,
|
| 592 |
+
'-framerate', str(self.fps)]
|
| 593 |
+
# Logging is quieted because subprocess.PIPE has limited buffer size.
|
| 594 |
+
# If you have a lot of frames in your animation and set logging to
|
| 595 |
+
# DEBUG, you will have a buffer overrun.
|
| 596 |
+
if _log.getEffectiveLevel() > logging.DEBUG:
|
| 597 |
+
args += ['-loglevel', 'error']
|
| 598 |
+
args += ['-i', 'pipe:'] + self.output_args
|
| 599 |
+
return args
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
# Combine FFMpeg options with temp file-based writing
|
| 603 |
+
@writers.register('ffmpeg_file')
|
| 604 |
+
class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
|
| 605 |
+
"""
|
| 606 |
+
File-based ffmpeg writer.
|
| 607 |
+
|
| 608 |
+
Frames are written to temporary files on disk and then stitched together at the end.
|
| 609 |
+
|
| 610 |
+
This effectively works as a slideshow input to ffmpeg with the fps passed as
|
| 611 |
+
``-framerate``, so see also `their notes on frame rates`_ for further details.
|
| 612 |
+
|
| 613 |
+
.. _their notes on frame rates: https://trac.ffmpeg.org/wiki/Slideshow#Framerates
|
| 614 |
+
"""
|
| 615 |
+
supported_formats = ['png', 'jpeg', 'tiff', 'raw', 'rgba']
|
| 616 |
+
|
| 617 |
+
def _args(self):
|
| 618 |
+
# Returns the command line parameters for subprocess to use
|
| 619 |
+
# ffmpeg to create a movie using a collection of temp images
|
| 620 |
+
args = []
|
| 621 |
+
# For raw frames, we need to explicitly tell ffmpeg the metadata.
|
| 622 |
+
if self.frame_format in {'raw', 'rgba'}:
|
| 623 |
+
args += [
|
| 624 |
+
'-f', 'image2', '-vcodec', 'rawvideo',
|
| 625 |
+
'-video_size', '%dx%d' % self.frame_size,
|
| 626 |
+
'-pixel_format', 'rgba',
|
| 627 |
+
]
|
| 628 |
+
args += ['-framerate', str(self.fps), '-i', self._base_temp_name()]
|
| 629 |
+
if not self._tmpdir:
|
| 630 |
+
args += ['-frames:v', str(self._frame_counter)]
|
| 631 |
+
# Logging is quieted because subprocess.PIPE has limited buffer size.
|
| 632 |
+
# If you have a lot of frames in your animation and set logging to
|
| 633 |
+
# DEBUG, you will have a buffer overrun.
|
| 634 |
+
if _log.getEffectiveLevel() > logging.DEBUG:
|
| 635 |
+
args += ['-loglevel', 'error']
|
| 636 |
+
return [self.bin_path(), *args, *self.output_args]
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
# Base class for animated GIFs with ImageMagick
|
| 640 |
+
class ImageMagickBase:
|
| 641 |
+
"""
|
| 642 |
+
Mixin class for ImageMagick output.
|
| 643 |
+
|
| 644 |
+
This is a base class for the concrete `ImageMagickWriter` and
|
| 645 |
+
`ImageMagickFileWriter` classes, which define an ``input_names`` attribute
|
| 646 |
+
(or property) specifying the input names passed to ImageMagick.
|
| 647 |
+
"""
|
| 648 |
+
|
| 649 |
+
_exec_key = 'animation.convert_path'
|
| 650 |
+
_args_key = 'animation.convert_args'
|
| 651 |
+
|
| 652 |
+
def _supports_transparency(self):
|
| 653 |
+
suffix = Path(self.outfile).suffix
|
| 654 |
+
return suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}
|
| 655 |
+
|
| 656 |
+
def _args(self):
|
| 657 |
+
# ImageMagick does not recognize "raw".
|
| 658 |
+
fmt = "rgba" if self.frame_format == "raw" else self.frame_format
|
| 659 |
+
extra_args = (self.extra_args if self.extra_args is not None
|
| 660 |
+
else mpl.rcParams[self._args_key])
|
| 661 |
+
return [
|
| 662 |
+
self.bin_path(),
|
| 663 |
+
"-size", "%ix%i" % self.frame_size,
|
| 664 |
+
"-depth", "8",
|
| 665 |
+
"-delay", str(100 / self.fps),
|
| 666 |
+
"-loop", "0",
|
| 667 |
+
f"{fmt}:{self.input_names}",
|
| 668 |
+
*extra_args,
|
| 669 |
+
self.outfile,
|
| 670 |
+
]
|
| 671 |
+
|
| 672 |
+
@classmethod
|
| 673 |
+
def bin_path(cls):
|
| 674 |
+
binpath = super().bin_path()
|
| 675 |
+
if binpath == 'convert':
|
| 676 |
+
binpath = mpl._get_executable_info('magick').executable
|
| 677 |
+
return binpath
|
| 678 |
+
|
| 679 |
+
@classmethod
|
| 680 |
+
def isAvailable(cls):
|
| 681 |
+
try:
|
| 682 |
+
return super().isAvailable()
|
| 683 |
+
except mpl.ExecutableNotFoundError as _enf:
|
| 684 |
+
# May be raised by get_executable_info.
|
| 685 |
+
_log.debug('ImageMagick unavailable due to: %s', _enf)
|
| 686 |
+
return False
|
| 687 |
+
|
| 688 |
+
|
| 689 |
+
# Combine ImageMagick options with pipe-based writing
|
| 690 |
+
@writers.register('imagemagick')
|
| 691 |
+
class ImageMagickWriter(ImageMagickBase, MovieWriter):
|
| 692 |
+
"""
|
| 693 |
+
Pipe-based animated gif writer.
|
| 694 |
+
|
| 695 |
+
Frames are streamed directly to ImageMagick via a pipe and written
|
| 696 |
+
in a single pass.
|
| 697 |
+
"""
|
| 698 |
+
|
| 699 |
+
input_names = "-" # stdin
|
| 700 |
+
|
| 701 |
+
|
| 702 |
+
# Combine ImageMagick options with temp file-based writing
|
| 703 |
+
@writers.register('imagemagick_file')
|
| 704 |
+
class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
|
| 705 |
+
"""
|
| 706 |
+
File-based animated gif writer.
|
| 707 |
+
|
| 708 |
+
Frames are written to temporary files on disk and then stitched
|
| 709 |
+
together at the end.
|
| 710 |
+
"""
|
| 711 |
+
|
| 712 |
+
supported_formats = ['png', 'jpeg', 'tiff', 'raw', 'rgba']
|
| 713 |
+
input_names = property(
|
| 714 |
+
lambda self: f'{self.temp_prefix}*.{self.frame_format}')
|
| 715 |
+
|
| 716 |
+
|
| 717 |
+
# Taken directly from jakevdp's JSAnimation package at
|
| 718 |
+
# http://github.com/jakevdp/JSAnimation
|
| 719 |
+
def _included_frames(frame_count, frame_format, frame_dir):
|
| 720 |
+
return INCLUDED_FRAMES.format(Nframes=frame_count,
|
| 721 |
+
frame_dir=frame_dir,
|
| 722 |
+
frame_format=frame_format)
|
| 723 |
+
|
| 724 |
+
|
| 725 |
+
def _embedded_frames(frame_list, frame_format):
|
| 726 |
+
"""frame_list should be a list of base64-encoded png files"""
|
| 727 |
+
if frame_format == 'svg':
|
| 728 |
+
# Fix MIME type for svg
|
| 729 |
+
frame_format = 'svg+xml'
|
| 730 |
+
template = ' frames[{0}] = "data:image/{1};base64,{2}"\n'
|
| 731 |
+
return "\n" + "".join(
|
| 732 |
+
template.format(i, frame_format, frame_data.replace('\n', '\\\n'))
|
| 733 |
+
for i, frame_data in enumerate(frame_list))
|
| 734 |
+
|
| 735 |
+
|
| 736 |
+
@writers.register('html')
|
| 737 |
+
class HTMLWriter(FileMovieWriter):
|
| 738 |
+
"""Writer for JavaScript-based HTML movies."""
|
| 739 |
+
|
| 740 |
+
supported_formats = ['png', 'jpeg', 'tiff', 'svg']
|
| 741 |
+
|
| 742 |
+
@classmethod
|
| 743 |
+
def isAvailable(cls):
|
| 744 |
+
return True
|
| 745 |
+
|
| 746 |
+
def __init__(self, fps=30, codec=None, bitrate=None, extra_args=None,
|
| 747 |
+
metadata=None, embed_frames=False, default_mode='loop',
|
| 748 |
+
embed_limit=None):
|
| 749 |
+
|
| 750 |
+
if extra_args:
|
| 751 |
+
_log.warning("HTMLWriter ignores 'extra_args'")
|
| 752 |
+
extra_args = () # Don't lookup nonexistent rcParam[args_key].
|
| 753 |
+
self.embed_frames = embed_frames
|
| 754 |
+
self.default_mode = default_mode.lower()
|
| 755 |
+
_api.check_in_list(['loop', 'once', 'reflect'],
|
| 756 |
+
default_mode=self.default_mode)
|
| 757 |
+
|
| 758 |
+
# Save embed limit, which is given in MB
|
| 759 |
+
self._bytes_limit = mpl._val_or_rc(embed_limit, 'animation.embed_limit')
|
| 760 |
+
# Convert from MB to bytes
|
| 761 |
+
self._bytes_limit *= 1024 * 1024
|
| 762 |
+
|
| 763 |
+
super().__init__(fps, codec, bitrate, extra_args, metadata)
|
| 764 |
+
|
| 765 |
+
def setup(self, fig, outfile, dpi=None, frame_dir=None):
|
| 766 |
+
outfile = Path(outfile)
|
| 767 |
+
_api.check_in_list(['.html', '.htm'], outfile_extension=outfile.suffix)
|
| 768 |
+
|
| 769 |
+
self._saved_frames = []
|
| 770 |
+
self._total_bytes = 0
|
| 771 |
+
self._hit_limit = False
|
| 772 |
+
|
| 773 |
+
if not self.embed_frames:
|
| 774 |
+
if frame_dir is None:
|
| 775 |
+
frame_dir = outfile.with_name(outfile.stem + '_frames')
|
| 776 |
+
frame_dir.mkdir(parents=True, exist_ok=True)
|
| 777 |
+
frame_prefix = frame_dir / 'frame'
|
| 778 |
+
else:
|
| 779 |
+
frame_prefix = None
|
| 780 |
+
|
| 781 |
+
super().setup(fig, outfile, dpi, frame_prefix)
|
| 782 |
+
self._clear_temp = False
|
| 783 |
+
|
| 784 |
+
def grab_frame(self, **savefig_kwargs):
|
| 785 |
+
_validate_grabframe_kwargs(savefig_kwargs)
|
| 786 |
+
if self.embed_frames:
|
| 787 |
+
# Just stop processing if we hit the limit
|
| 788 |
+
if self._hit_limit:
|
| 789 |
+
return
|
| 790 |
+
f = BytesIO()
|
| 791 |
+
self.fig.savefig(f, format=self.frame_format,
|
| 792 |
+
dpi=self.dpi, **savefig_kwargs)
|
| 793 |
+
imgdata64 = base64.encodebytes(f.getvalue()).decode('ascii')
|
| 794 |
+
self._total_bytes += len(imgdata64)
|
| 795 |
+
if self._total_bytes >= self._bytes_limit:
|
| 796 |
+
_log.warning(
|
| 797 |
+
"Animation size has reached %s bytes, exceeding the limit "
|
| 798 |
+
"of %s. If you're sure you want a larger animation "
|
| 799 |
+
"embedded, set the animation.embed_limit rc parameter to "
|
| 800 |
+
"a larger value (in MB). This and further frames will be "
|
| 801 |
+
"dropped.", self._total_bytes, self._bytes_limit)
|
| 802 |
+
self._hit_limit = True
|
| 803 |
+
else:
|
| 804 |
+
self._saved_frames.append(imgdata64)
|
| 805 |
+
else:
|
| 806 |
+
return super().grab_frame(**savefig_kwargs)
|
| 807 |
+
|
| 808 |
+
def finish(self):
|
| 809 |
+
# save the frames to an html file
|
| 810 |
+
if self.embed_frames:
|
| 811 |
+
fill_frames = _embedded_frames(self._saved_frames,
|
| 812 |
+
self.frame_format)
|
| 813 |
+
frame_count = len(self._saved_frames)
|
| 814 |
+
else:
|
| 815 |
+
# temp names is filled by FileMovieWriter
|
| 816 |
+
frame_count = len(self._temp_paths)
|
| 817 |
+
fill_frames = _included_frames(
|
| 818 |
+
frame_count, self.frame_format,
|
| 819 |
+
self._temp_paths[0].parent.relative_to(self.outfile.parent))
|
| 820 |
+
mode_dict = dict(once_checked='',
|
| 821 |
+
loop_checked='',
|
| 822 |
+
reflect_checked='')
|
| 823 |
+
mode_dict[self.default_mode + '_checked'] = 'checked'
|
| 824 |
+
|
| 825 |
+
interval = 1000 // self.fps
|
| 826 |
+
|
| 827 |
+
with open(self.outfile, 'w') as of:
|
| 828 |
+
of.write(JS_INCLUDE + STYLE_INCLUDE)
|
| 829 |
+
of.write(DISPLAY_TEMPLATE.format(id=uuid.uuid4().hex,
|
| 830 |
+
Nframes=frame_count,
|
| 831 |
+
fill_frames=fill_frames,
|
| 832 |
+
interval=interval,
|
| 833 |
+
**mode_dict))
|
| 834 |
+
|
| 835 |
+
# Duplicate the temporary file clean up logic from
|
| 836 |
+
# FileMovieWriter.finish. We cannot call the inherited version of
|
| 837 |
+
# finish because it assumes that there is a subprocess that we either
|
| 838 |
+
# need to call to merge many frames together or that there is a
|
| 839 |
+
# subprocess call that we need to clean up.
|
| 840 |
+
if self._tmpdir:
|
| 841 |
+
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
|
| 842 |
+
self._tmpdir.cleanup()
|
| 843 |
+
|
| 844 |
+
|
| 845 |
+
class Animation:
|
| 846 |
+
"""
|
| 847 |
+
A base class for Animations.
|
| 848 |
+
|
| 849 |
+
This class is not usable as is, and should be subclassed to provide needed
|
| 850 |
+
behavior.
|
| 851 |
+
|
| 852 |
+
.. note::
|
| 853 |
+
|
| 854 |
+
You must store the created Animation in a variable that lives as long
|
| 855 |
+
as the animation should run. Otherwise, the Animation object will be
|
| 856 |
+
garbage-collected and the animation stops.
|
| 857 |
+
|
| 858 |
+
Parameters
|
| 859 |
+
----------
|
| 860 |
+
fig : `~matplotlib.figure.Figure`
|
| 861 |
+
The figure object used to get needed events, such as draw or resize.
|
| 862 |
+
|
| 863 |
+
event_source : object, optional
|
| 864 |
+
A class that can run a callback when desired events
|
| 865 |
+
are generated, as well as be stopped and started.
|
| 866 |
+
|
| 867 |
+
Examples include timers (see `TimedAnimation`) and file
|
| 868 |
+
system notifications.
|
| 869 |
+
|
| 870 |
+
blit : bool, default: False
|
| 871 |
+
Whether blitting is used to optimize drawing. If the backend does not
|
| 872 |
+
support blitting, then this parameter has no effect.
|
| 873 |
+
|
| 874 |
+
See Also
|
| 875 |
+
--------
|
| 876 |
+
FuncAnimation, ArtistAnimation
|
| 877 |
+
"""
|
| 878 |
+
|
| 879 |
+
def __init__(self, fig, event_source=None, blit=False):
|
| 880 |
+
self._draw_was_started = False
|
| 881 |
+
|
| 882 |
+
self._fig = fig
|
| 883 |
+
# Disables blitting for backends that don't support it. This
|
| 884 |
+
# allows users to request it if available, but still have a
|
| 885 |
+
# fallback that works if it is not.
|
| 886 |
+
self._blit = blit and fig.canvas.supports_blit
|
| 887 |
+
|
| 888 |
+
# These are the basics of the animation. The frame sequence represents
|
| 889 |
+
# information for each frame of the animation and depends on how the
|
| 890 |
+
# drawing is handled by the subclasses. The event source fires events
|
| 891 |
+
# that cause the frame sequence to be iterated.
|
| 892 |
+
self.frame_seq = self.new_frame_seq()
|
| 893 |
+
self.event_source = event_source
|
| 894 |
+
|
| 895 |
+
# Instead of starting the event source now, we connect to the figure's
|
| 896 |
+
# draw_event, so that we only start once the figure has been drawn.
|
| 897 |
+
self._first_draw_id = fig.canvas.mpl_connect('draw_event', self._start)
|
| 898 |
+
|
| 899 |
+
# Connect to the figure's close_event so that we don't continue to
|
| 900 |
+
# fire events and try to draw to a deleted figure.
|
| 901 |
+
self._close_id = self._fig.canvas.mpl_connect('close_event',
|
| 902 |
+
self._stop)
|
| 903 |
+
if self._blit:
|
| 904 |
+
self._setup_blit()
|
| 905 |
+
|
| 906 |
+
def __del__(self):
|
| 907 |
+
if not getattr(self, '_draw_was_started', True):
|
| 908 |
+
warnings.warn(
|
| 909 |
+
'Animation was deleted without rendering anything. This is '
|
| 910 |
+
'most likely not intended. To prevent deletion, assign the '
|
| 911 |
+
'Animation to a variable, e.g. `anim`, that exists until you '
|
| 912 |
+
'output the Animation using `plt.show()` or '
|
| 913 |
+
'`anim.save()`.'
|
| 914 |
+
)
|
| 915 |
+
|
| 916 |
+
def _start(self, *args):
|
| 917 |
+
"""
|
| 918 |
+
Starts interactive animation. Adds the draw frame command to the GUI
|
| 919 |
+
handler, calls show to start the event loop.
|
| 920 |
+
"""
|
| 921 |
+
# Do not start the event source if saving() it.
|
| 922 |
+
if self._fig.canvas.is_saving():
|
| 923 |
+
return
|
| 924 |
+
# First disconnect our draw event handler
|
| 925 |
+
self._fig.canvas.mpl_disconnect(self._first_draw_id)
|
| 926 |
+
|
| 927 |
+
# Now do any initial draw
|
| 928 |
+
self._init_draw()
|
| 929 |
+
|
| 930 |
+
# Add our callback for stepping the animation and
|
| 931 |
+
# actually start the event_source.
|
| 932 |
+
self.event_source.add_callback(self._step)
|
| 933 |
+
self.event_source.start()
|
| 934 |
+
|
| 935 |
+
def _stop(self, *args):
|
| 936 |
+
# On stop we disconnect all of our events.
|
| 937 |
+
if self._blit:
|
| 938 |
+
self._fig.canvas.mpl_disconnect(self._resize_id)
|
| 939 |
+
self._fig.canvas.mpl_disconnect(self._close_id)
|
| 940 |
+
self.event_source.remove_callback(self._step)
|
| 941 |
+
self.event_source = None
|
| 942 |
+
|
| 943 |
+
def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
|
| 944 |
+
bitrate=None, extra_args=None, metadata=None, extra_anim=None,
|
| 945 |
+
savefig_kwargs=None, *, progress_callback=None):
|
| 946 |
+
"""
|
| 947 |
+
Save the animation as a movie file by drawing every frame.
|
| 948 |
+
|
| 949 |
+
Parameters
|
| 950 |
+
----------
|
| 951 |
+
filename : str
|
| 952 |
+
The output filename, e.g., :file:`mymovie.mp4`.
|
| 953 |
+
|
| 954 |
+
writer : `MovieWriter` or str, default: :rc:`animation.writer`
|
| 955 |
+
A `MovieWriter` instance to use or a key that identifies a
|
| 956 |
+
class to use, such as 'ffmpeg'.
|
| 957 |
+
|
| 958 |
+
fps : int, optional
|
| 959 |
+
Movie frame rate (per second). If not set, the frame rate from the
|
| 960 |
+
animation's frame interval.
|
| 961 |
+
|
| 962 |
+
dpi : float, default: :rc:`savefig.dpi`
|
| 963 |
+
Controls the dots per inch for the movie frames. Together with
|
| 964 |
+
the figure's size in inches, this controls the size of the movie.
|
| 965 |
+
|
| 966 |
+
codec : str, default: :rc:`animation.codec`.
|
| 967 |
+
The video codec to use. Not all codecs are supported by a given
|
| 968 |
+
`MovieWriter`.
|
| 969 |
+
|
| 970 |
+
bitrate : int, default: :rc:`animation.bitrate`
|
| 971 |
+
The bitrate of the movie, in kilobits per second. Higher values
|
| 972 |
+
means higher quality movies, but increase the file size. A value
|
| 973 |
+
of -1 lets the underlying movie encoder select the bitrate.
|
| 974 |
+
|
| 975 |
+
extra_args : list of str or None, optional
|
| 976 |
+
Extra command-line arguments passed to the underlying movie encoder. These
|
| 977 |
+
arguments are passed last to the encoder, just before the output filename.
|
| 978 |
+
The default, None, means to use :rc:`animation.[name-of-encoder]_args` for
|
| 979 |
+
the builtin writers.
|
| 980 |
+
|
| 981 |
+
metadata : dict[str, str], default: {}
|
| 982 |
+
Dictionary of keys and values for metadata to include in
|
| 983 |
+
the output file. Some keys that may be of use include:
|
| 984 |
+
title, artist, genre, subject, copyright, srcform, comment.
|
| 985 |
+
|
| 986 |
+
extra_anim : list, default: []
|
| 987 |
+
Additional `Animation` objects that should be included
|
| 988 |
+
in the saved movie file. These need to be from the same
|
| 989 |
+
`.Figure` instance. Also, animation frames will
|
| 990 |
+
just be simply combined, so there should be a 1:1 correspondence
|
| 991 |
+
between the frames from the different animations.
|
| 992 |
+
|
| 993 |
+
savefig_kwargs : dict, default: {}
|
| 994 |
+
Keyword arguments passed to each `~.Figure.savefig` call used to
|
| 995 |
+
save the individual frames.
|
| 996 |
+
|
| 997 |
+
progress_callback : function, optional
|
| 998 |
+
A callback function that will be called for every frame to notify
|
| 999 |
+
the saving progress. It must have the signature ::
|
| 1000 |
+
|
| 1001 |
+
def func(current_frame: int, total_frames: int) -> Any
|
| 1002 |
+
|
| 1003 |
+
where *current_frame* is the current frame number and *total_frames* is the
|
| 1004 |
+
total number of frames to be saved. *total_frames* is set to None, if the
|
| 1005 |
+
total number of frames cannot be determined. Return values may exist but are
|
| 1006 |
+
ignored.
|
| 1007 |
+
|
| 1008 |
+
Example code to write the progress to stdout::
|
| 1009 |
+
|
| 1010 |
+
progress_callback = lambda i, n: print(f'Saving frame {i}/{n}')
|
| 1011 |
+
|
| 1012 |
+
Notes
|
| 1013 |
+
-----
|
| 1014 |
+
*fps*, *codec*, *bitrate*, *extra_args* and *metadata* are used to
|
| 1015 |
+
construct a `.MovieWriter` instance and can only be passed if
|
| 1016 |
+
*writer* is a string. If they are passed as non-*None* and *writer*
|
| 1017 |
+
is a `.MovieWriter`, a `RuntimeError` will be raised.
|
| 1018 |
+
"""
|
| 1019 |
+
|
| 1020 |
+
all_anim = [self]
|
| 1021 |
+
if extra_anim is not None:
|
| 1022 |
+
all_anim.extend(anim for anim in extra_anim
|
| 1023 |
+
if anim._fig is self._fig)
|
| 1024 |
+
|
| 1025 |
+
# Disable "Animation was deleted without rendering" warning.
|
| 1026 |
+
for anim in all_anim:
|
| 1027 |
+
anim._draw_was_started = True
|
| 1028 |
+
|
| 1029 |
+
if writer is None:
|
| 1030 |
+
writer = mpl.rcParams['animation.writer']
|
| 1031 |
+
elif (not isinstance(writer, str) and
|
| 1032 |
+
any(arg is not None
|
| 1033 |
+
for arg in (fps, codec, bitrate, extra_args, metadata))):
|
| 1034 |
+
raise RuntimeError('Passing in values for arguments '
|
| 1035 |
+
'fps, codec, bitrate, extra_args, or metadata '
|
| 1036 |
+
'is not supported when writer is an existing '
|
| 1037 |
+
'MovieWriter instance. These should instead be '
|
| 1038 |
+
'passed as arguments when creating the '
|
| 1039 |
+
'MovieWriter instance.')
|
| 1040 |
+
|
| 1041 |
+
if savefig_kwargs is None:
|
| 1042 |
+
savefig_kwargs = {}
|
| 1043 |
+
else:
|
| 1044 |
+
# we are going to mutate this below
|
| 1045 |
+
savefig_kwargs = dict(savefig_kwargs)
|
| 1046 |
+
|
| 1047 |
+
if fps is None and hasattr(self, '_interval'):
|
| 1048 |
+
# Convert interval in ms to frames per second
|
| 1049 |
+
fps = 1000. / self._interval
|
| 1050 |
+
|
| 1051 |
+
# Reuse the savefig DPI for ours if none is given.
|
| 1052 |
+
dpi = mpl._val_or_rc(dpi, 'savefig.dpi')
|
| 1053 |
+
if dpi == 'figure':
|
| 1054 |
+
dpi = self._fig.dpi
|
| 1055 |
+
|
| 1056 |
+
writer_kwargs = {}
|
| 1057 |
+
if codec is not None:
|
| 1058 |
+
writer_kwargs['codec'] = codec
|
| 1059 |
+
if bitrate is not None:
|
| 1060 |
+
writer_kwargs['bitrate'] = bitrate
|
| 1061 |
+
if extra_args is not None:
|
| 1062 |
+
writer_kwargs['extra_args'] = extra_args
|
| 1063 |
+
if metadata is not None:
|
| 1064 |
+
writer_kwargs['metadata'] = metadata
|
| 1065 |
+
|
| 1066 |
+
# If we have the name of a writer, instantiate an instance of the
|
| 1067 |
+
# registered class.
|
| 1068 |
+
if isinstance(writer, str):
|
| 1069 |
+
try:
|
| 1070 |
+
writer_cls = writers[writer]
|
| 1071 |
+
except RuntimeError: # Raised if not available.
|
| 1072 |
+
writer_cls = PillowWriter # Always available.
|
| 1073 |
+
_log.warning("MovieWriter %s unavailable; using Pillow "
|
| 1074 |
+
"instead.", writer)
|
| 1075 |
+
writer = writer_cls(fps, **writer_kwargs)
|
| 1076 |
+
_log.info('Animation.save using %s', type(writer))
|
| 1077 |
+
|
| 1078 |
+
if 'bbox_inches' in savefig_kwargs:
|
| 1079 |
+
_log.warning("Warning: discarding the 'bbox_inches' argument in "
|
| 1080 |
+
"'savefig_kwargs' as it may cause frame size "
|
| 1081 |
+
"to vary, which is inappropriate for animation.")
|
| 1082 |
+
savefig_kwargs.pop('bbox_inches')
|
| 1083 |
+
|
| 1084 |
+
# Create a new sequence of frames for saved data. This is different
|
| 1085 |
+
# from new_frame_seq() to give the ability to save 'live' generated
|
| 1086 |
+
# frame information to be saved later.
|
| 1087 |
+
# TODO: Right now, after closing the figure, saving a movie won't work
|
| 1088 |
+
# since GUI widgets are gone. Either need to remove extra code to
|
| 1089 |
+
# allow for this non-existent use case or find a way to make it work.
|
| 1090 |
+
|
| 1091 |
+
def _pre_composite_to_white(color):
|
| 1092 |
+
r, g, b, a = mcolors.to_rgba(color)
|
| 1093 |
+
return a * np.array([r, g, b]) + 1 - a
|
| 1094 |
+
|
| 1095 |
+
# canvas._is_saving = True makes the draw_event animation-starting
|
| 1096 |
+
# callback a no-op; canvas.manager = None prevents resizing the GUI
|
| 1097 |
+
# widget (both are likewise done in savefig()).
|
| 1098 |
+
with (writer.saving(self._fig, filename, dpi),
|
| 1099 |
+
cbook._setattr_cm(self._fig.canvas, _is_saving=True, manager=None)):
|
| 1100 |
+
if not writer._supports_transparency():
|
| 1101 |
+
facecolor = savefig_kwargs.get('facecolor',
|
| 1102 |
+
mpl.rcParams['savefig.facecolor'])
|
| 1103 |
+
if facecolor == 'auto':
|
| 1104 |
+
facecolor = self._fig.get_facecolor()
|
| 1105 |
+
savefig_kwargs['facecolor'] = _pre_composite_to_white(facecolor)
|
| 1106 |
+
savefig_kwargs['transparent'] = False # just to be safe!
|
| 1107 |
+
|
| 1108 |
+
for anim in all_anim:
|
| 1109 |
+
anim._init_draw() # Clear the initial frame
|
| 1110 |
+
frame_number = 0
|
| 1111 |
+
# TODO: Currently only FuncAnimation has a save_count
|
| 1112 |
+
# attribute. Can we generalize this to all Animations?
|
| 1113 |
+
save_count_list = [getattr(a, '_save_count', None)
|
| 1114 |
+
for a in all_anim]
|
| 1115 |
+
if None in save_count_list:
|
| 1116 |
+
total_frames = None
|
| 1117 |
+
else:
|
| 1118 |
+
total_frames = sum(save_count_list)
|
| 1119 |
+
for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
|
| 1120 |
+
for anim, d in zip(all_anim, data):
|
| 1121 |
+
# TODO: See if turning off blit is really necessary
|
| 1122 |
+
anim._draw_next_frame(d, blit=False)
|
| 1123 |
+
if progress_callback is not None:
|
| 1124 |
+
progress_callback(frame_number, total_frames)
|
| 1125 |
+
frame_number += 1
|
| 1126 |
+
writer.grab_frame(**savefig_kwargs)
|
| 1127 |
+
|
| 1128 |
+
def _step(self, *args):
|
| 1129 |
+
"""
|
| 1130 |
+
Handler for getting events. By default, gets the next frame in the
|
| 1131 |
+
sequence and hands the data off to be drawn.
|
| 1132 |
+
"""
|
| 1133 |
+
# Returns True to indicate that the event source should continue to
|
| 1134 |
+
# call _step, until the frame sequence reaches the end of iteration,
|
| 1135 |
+
# at which point False will be returned.
|
| 1136 |
+
try:
|
| 1137 |
+
framedata = next(self.frame_seq)
|
| 1138 |
+
self._draw_next_frame(framedata, self._blit)
|
| 1139 |
+
return True
|
| 1140 |
+
except StopIteration:
|
| 1141 |
+
return False
|
| 1142 |
+
|
| 1143 |
+
def new_frame_seq(self):
|
| 1144 |
+
"""Return a new sequence of frame information."""
|
| 1145 |
+
# Default implementation is just an iterator over self._framedata
|
| 1146 |
+
return iter(self._framedata)
|
| 1147 |
+
|
| 1148 |
+
def new_saved_frame_seq(self):
|
| 1149 |
+
"""Return a new sequence of saved/cached frame information."""
|
| 1150 |
+
# Default is the same as the regular frame sequence
|
| 1151 |
+
return self.new_frame_seq()
|
| 1152 |
+
|
| 1153 |
+
def _draw_next_frame(self, framedata, blit):
|
| 1154 |
+
# Breaks down the drawing of the next frame into steps of pre- and
|
| 1155 |
+
# post- draw, as well as the drawing of the frame itself.
|
| 1156 |
+
self._pre_draw(framedata, blit)
|
| 1157 |
+
self._draw_frame(framedata)
|
| 1158 |
+
self._post_draw(framedata, blit)
|
| 1159 |
+
|
| 1160 |
+
def _init_draw(self):
|
| 1161 |
+
# Initial draw to clear the frame. Also used by the blitting code
|
| 1162 |
+
# when a clean base is required.
|
| 1163 |
+
self._draw_was_started = True
|
| 1164 |
+
|
| 1165 |
+
def _pre_draw(self, framedata, blit):
|
| 1166 |
+
# Perform any cleaning or whatnot before the drawing of the frame.
|
| 1167 |
+
# This default implementation allows blit to clear the frame.
|
| 1168 |
+
if blit:
|
| 1169 |
+
self._blit_clear(self._drawn_artists)
|
| 1170 |
+
|
| 1171 |
+
def _draw_frame(self, framedata):
|
| 1172 |
+
# Performs actual drawing of the frame.
|
| 1173 |
+
raise NotImplementedError('Needs to be implemented by subclasses to'
|
| 1174 |
+
' actually make an animation.')
|
| 1175 |
+
|
| 1176 |
+
def _post_draw(self, framedata, blit):
|
| 1177 |
+
# After the frame is rendered, this handles the actual flushing of
|
| 1178 |
+
# the draw, which can be a direct draw_idle() or make use of the
|
| 1179 |
+
# blitting.
|
| 1180 |
+
if blit and self._drawn_artists:
|
| 1181 |
+
self._blit_draw(self._drawn_artists)
|
| 1182 |
+
else:
|
| 1183 |
+
self._fig.canvas.draw_idle()
|
| 1184 |
+
|
| 1185 |
+
# The rest of the code in this class is to facilitate easy blitting
|
| 1186 |
+
def _blit_draw(self, artists):
|
| 1187 |
+
# Handles blitted drawing, which renders only the artists given instead
|
| 1188 |
+
# of the entire figure.
|
| 1189 |
+
updated_ax = {a.axes for a in artists}
|
| 1190 |
+
# Enumerate artists to cache Axes backgrounds. We do not draw
|
| 1191 |
+
# artists yet to not cache foreground from plots with shared Axes
|
| 1192 |
+
for ax in updated_ax:
|
| 1193 |
+
# If we haven't cached the background for the current view of this
|
| 1194 |
+
# Axes object, do so now. This might not always be reliable, but
|
| 1195 |
+
# it's an attempt to automate the process.
|
| 1196 |
+
cur_view = ax._get_view()
|
| 1197 |
+
view, bg = self._blit_cache.get(ax, (object(), None))
|
| 1198 |
+
if cur_view != view:
|
| 1199 |
+
self._blit_cache[ax] = (
|
| 1200 |
+
cur_view, ax.figure.canvas.copy_from_bbox(ax.bbox))
|
| 1201 |
+
# Make a separate pass to draw foreground.
|
| 1202 |
+
for a in artists:
|
| 1203 |
+
a.axes.draw_artist(a)
|
| 1204 |
+
# After rendering all the needed artists, blit each Axes individually.
|
| 1205 |
+
for ax in updated_ax:
|
| 1206 |
+
ax.figure.canvas.blit(ax.bbox)
|
| 1207 |
+
|
| 1208 |
+
def _blit_clear(self, artists):
|
| 1209 |
+
# Get a list of the Axes that need clearing from the artists that
|
| 1210 |
+
# have been drawn. Grab the appropriate saved background from the
|
| 1211 |
+
# cache and restore.
|
| 1212 |
+
axes = {a.axes for a in artists}
|
| 1213 |
+
for ax in axes:
|
| 1214 |
+
try:
|
| 1215 |
+
view, bg = self._blit_cache[ax]
|
| 1216 |
+
except KeyError:
|
| 1217 |
+
continue
|
| 1218 |
+
if ax._get_view() == view:
|
| 1219 |
+
ax.figure.canvas.restore_region(bg)
|
| 1220 |
+
else:
|
| 1221 |
+
self._blit_cache.pop(ax)
|
| 1222 |
+
|
| 1223 |
+
def _setup_blit(self):
|
| 1224 |
+
# Setting up the blit requires: a cache of the background for the Axes
|
| 1225 |
+
self._blit_cache = dict()
|
| 1226 |
+
self._drawn_artists = []
|
| 1227 |
+
# _post_draw needs to be called first to initialize the renderer
|
| 1228 |
+
self._post_draw(None, self._blit)
|
| 1229 |
+
# Then we need to clear the Frame for the initial draw
|
| 1230 |
+
# This is typically handled in _on_resize because QT and Tk
|
| 1231 |
+
# emit a resize event on launch, but the macosx backend does not,
|
| 1232 |
+
# thus we force it here for everyone for consistency
|
| 1233 |
+
self._init_draw()
|
| 1234 |
+
# Connect to future resize events
|
| 1235 |
+
self._resize_id = self._fig.canvas.mpl_connect('resize_event',
|
| 1236 |
+
self._on_resize)
|
| 1237 |
+
|
| 1238 |
+
def _on_resize(self, event):
|
| 1239 |
+
# On resize, we need to disable the resize event handling so we don't
|
| 1240 |
+
# get too many events. Also stop the animation events, so that
|
| 1241 |
+
# we're paused. Reset the cache and re-init. Set up an event handler
|
| 1242 |
+
# to catch once the draw has actually taken place.
|
| 1243 |
+
self._fig.canvas.mpl_disconnect(self._resize_id)
|
| 1244 |
+
self.event_source.stop()
|
| 1245 |
+
self._blit_cache.clear()
|
| 1246 |
+
self._init_draw()
|
| 1247 |
+
self._resize_id = self._fig.canvas.mpl_connect('draw_event',
|
| 1248 |
+
self._end_redraw)
|
| 1249 |
+
|
| 1250 |
+
def _end_redraw(self, event):
|
| 1251 |
+
# Now that the redraw has happened, do the post draw flushing and
|
| 1252 |
+
# blit handling. Then re-enable all of the original events.
|
| 1253 |
+
self._post_draw(None, False)
|
| 1254 |
+
self.event_source.start()
|
| 1255 |
+
self._fig.canvas.mpl_disconnect(self._resize_id)
|
| 1256 |
+
self._resize_id = self._fig.canvas.mpl_connect('resize_event',
|
| 1257 |
+
self._on_resize)
|
| 1258 |
+
|
| 1259 |
+
def to_html5_video(self, embed_limit=None):
|
| 1260 |
+
"""
|
| 1261 |
+
Convert the animation to an HTML5 ``<video>`` tag.
|
| 1262 |
+
|
| 1263 |
+
This saves the animation as an h264 video, encoded in base64
|
| 1264 |
+
directly into the HTML5 video tag. This respects :rc:`animation.writer`
|
| 1265 |
+
and :rc:`animation.bitrate`. This also makes use of the
|
| 1266 |
+
*interval* to control the speed, and uses the *repeat*
|
| 1267 |
+
parameter to decide whether to loop.
|
| 1268 |
+
|
| 1269 |
+
Parameters
|
| 1270 |
+
----------
|
| 1271 |
+
embed_limit : float, optional
|
| 1272 |
+
Limit, in MB, of the returned animation. No animation is created
|
| 1273 |
+
if the limit is exceeded.
|
| 1274 |
+
Defaults to :rc:`animation.embed_limit` = 20.0.
|
| 1275 |
+
|
| 1276 |
+
Returns
|
| 1277 |
+
-------
|
| 1278 |
+
str
|
| 1279 |
+
An HTML5 video tag with the animation embedded as base64 encoded
|
| 1280 |
+
h264 video.
|
| 1281 |
+
If the *embed_limit* is exceeded, this returns the string
|
| 1282 |
+
"Video too large to embed."
|
| 1283 |
+
"""
|
| 1284 |
+
VIDEO_TAG = r'''<video {size} {options}>
|
| 1285 |
+
<source type="video/mp4" src="data:video/mp4;base64,{video}">
|
| 1286 |
+
Your browser does not support the video tag.
|
| 1287 |
+
</video>'''
|
| 1288 |
+
# Cache the rendering of the video as HTML
|
| 1289 |
+
if not hasattr(self, '_base64_video'):
|
| 1290 |
+
# Save embed limit, which is given in MB
|
| 1291 |
+
embed_limit = mpl._val_or_rc(embed_limit, 'animation.embed_limit')
|
| 1292 |
+
|
| 1293 |
+
# Convert from MB to bytes
|
| 1294 |
+
embed_limit *= 1024 * 1024
|
| 1295 |
+
|
| 1296 |
+
# Can't open a NamedTemporaryFile twice on Windows, so use a
|
| 1297 |
+
# TemporaryDirectory instead.
|
| 1298 |
+
with TemporaryDirectory() as tmpdir:
|
| 1299 |
+
path = Path(tmpdir, "temp.m4v")
|
| 1300 |
+
# We create a writer manually so that we can get the
|
| 1301 |
+
# appropriate size for the tag
|
| 1302 |
+
Writer = writers[mpl.rcParams['animation.writer']]
|
| 1303 |
+
writer = Writer(codec='h264',
|
| 1304 |
+
bitrate=mpl.rcParams['animation.bitrate'],
|
| 1305 |
+
fps=1000. / self._interval)
|
| 1306 |
+
self.save(str(path), writer=writer)
|
| 1307 |
+
# Now open and base64 encode.
|
| 1308 |
+
vid64 = base64.encodebytes(path.read_bytes())
|
| 1309 |
+
|
| 1310 |
+
vid_len = len(vid64)
|
| 1311 |
+
if vid_len >= embed_limit:
|
| 1312 |
+
_log.warning(
|
| 1313 |
+
"Animation movie is %s bytes, exceeding the limit of %s. "
|
| 1314 |
+
"If you're sure you want a large animation embedded, set "
|
| 1315 |
+
"the animation.embed_limit rc parameter to a larger value "
|
| 1316 |
+
"(in MB).", vid_len, embed_limit)
|
| 1317 |
+
else:
|
| 1318 |
+
self._base64_video = vid64.decode('ascii')
|
| 1319 |
+
self._video_size = 'width="{}" height="{}"'.format(
|
| 1320 |
+
*writer.frame_size)
|
| 1321 |
+
|
| 1322 |
+
# If we exceeded the size, this attribute won't exist
|
| 1323 |
+
if hasattr(self, '_base64_video'):
|
| 1324 |
+
# Default HTML5 options are to autoplay and display video controls
|
| 1325 |
+
options = ['controls', 'autoplay']
|
| 1326 |
+
|
| 1327 |
+
# If we're set to repeat, make it loop
|
| 1328 |
+
if getattr(self, '_repeat', False):
|
| 1329 |
+
options.append('loop')
|
| 1330 |
+
|
| 1331 |
+
return VIDEO_TAG.format(video=self._base64_video,
|
| 1332 |
+
size=self._video_size,
|
| 1333 |
+
options=' '.join(options))
|
| 1334 |
+
else:
|
| 1335 |
+
return 'Video too large to embed.'
|
| 1336 |
+
|
| 1337 |
+
def to_jshtml(self, fps=None, embed_frames=True, default_mode=None):
|
| 1338 |
+
"""
|
| 1339 |
+
Generate HTML representation of the animation.
|
| 1340 |
+
|
| 1341 |
+
Parameters
|
| 1342 |
+
----------
|
| 1343 |
+
fps : int, optional
|
| 1344 |
+
Movie frame rate (per second). If not set, the frame rate from
|
| 1345 |
+
the animation's frame interval.
|
| 1346 |
+
embed_frames : bool, optional
|
| 1347 |
+
default_mode : str, optional
|
| 1348 |
+
What to do when the animation ends. Must be one of ``{'loop',
|
| 1349 |
+
'once', 'reflect'}``. Defaults to ``'loop'`` if the *repeat*
|
| 1350 |
+
parameter is True, otherwise ``'once'``.
|
| 1351 |
+
|
| 1352 |
+
Returns
|
| 1353 |
+
-------
|
| 1354 |
+
str
|
| 1355 |
+
An HTML representation of the animation embedded as a js object as
|
| 1356 |
+
produced with the `.HTMLWriter`.
|
| 1357 |
+
"""
|
| 1358 |
+
if fps is None and hasattr(self, '_interval'):
|
| 1359 |
+
# Convert interval in ms to frames per second
|
| 1360 |
+
fps = 1000 / self._interval
|
| 1361 |
+
|
| 1362 |
+
# If we're not given a default mode, choose one base on the value of
|
| 1363 |
+
# the _repeat attribute
|
| 1364 |
+
if default_mode is None:
|
| 1365 |
+
default_mode = 'loop' if getattr(self, '_repeat',
|
| 1366 |
+
False) else 'once'
|
| 1367 |
+
|
| 1368 |
+
if not hasattr(self, "_html_representation"):
|
| 1369 |
+
# Can't open a NamedTemporaryFile twice on Windows, so use a
|
| 1370 |
+
# TemporaryDirectory instead.
|
| 1371 |
+
with TemporaryDirectory() as tmpdir:
|
| 1372 |
+
path = Path(tmpdir, "temp.html")
|
| 1373 |
+
writer = HTMLWriter(fps=fps,
|
| 1374 |
+
embed_frames=embed_frames,
|
| 1375 |
+
default_mode=default_mode)
|
| 1376 |
+
self.save(str(path), writer=writer)
|
| 1377 |
+
self._html_representation = path.read_text()
|
| 1378 |
+
|
| 1379 |
+
return self._html_representation
|
| 1380 |
+
|
| 1381 |
+
def _repr_html_(self):
|
| 1382 |
+
"""IPython display hook for rendering."""
|
| 1383 |
+
fmt = mpl.rcParams['animation.html']
|
| 1384 |
+
if fmt == 'html5':
|
| 1385 |
+
return self.to_html5_video()
|
| 1386 |
+
elif fmt == 'jshtml':
|
| 1387 |
+
return self.to_jshtml()
|
| 1388 |
+
|
| 1389 |
+
def pause(self):
|
| 1390 |
+
"""Pause the animation."""
|
| 1391 |
+
self.event_source.stop()
|
| 1392 |
+
if self._blit:
|
| 1393 |
+
for artist in self._drawn_artists:
|
| 1394 |
+
artist.set_animated(False)
|
| 1395 |
+
|
| 1396 |
+
def resume(self):
|
| 1397 |
+
"""Resume the animation."""
|
| 1398 |
+
self.event_source.start()
|
| 1399 |
+
if self._blit:
|
| 1400 |
+
for artist in self._drawn_artists:
|
| 1401 |
+
artist.set_animated(True)
|
| 1402 |
+
|
| 1403 |
+
|
| 1404 |
+
class TimedAnimation(Animation):
|
| 1405 |
+
"""
|
| 1406 |
+
`Animation` subclass for time-based animation.
|
| 1407 |
+
|
| 1408 |
+
A new frame is drawn every *interval* milliseconds.
|
| 1409 |
+
|
| 1410 |
+
.. note::
|
| 1411 |
+
|
| 1412 |
+
You must store the created Animation in a variable that lives as long
|
| 1413 |
+
as the animation should run. Otherwise, the Animation object will be
|
| 1414 |
+
garbage-collected and the animation stops.
|
| 1415 |
+
|
| 1416 |
+
Parameters
|
| 1417 |
+
----------
|
| 1418 |
+
fig : `~matplotlib.figure.Figure`
|
| 1419 |
+
The figure object used to get needed events, such as draw or resize.
|
| 1420 |
+
interval : int, default: 200
|
| 1421 |
+
Delay between frames in milliseconds.
|
| 1422 |
+
repeat_delay : int, default: 0
|
| 1423 |
+
The delay in milliseconds between consecutive animation runs, if
|
| 1424 |
+
*repeat* is True.
|
| 1425 |
+
repeat : bool, default: True
|
| 1426 |
+
Whether the animation repeats when the sequence of frames is completed.
|
| 1427 |
+
blit : bool, default: False
|
| 1428 |
+
Whether blitting is used to optimize drawing.
|
| 1429 |
+
"""
|
| 1430 |
+
def __init__(self, fig, interval=200, repeat_delay=0, repeat=True,
|
| 1431 |
+
event_source=None, *args, **kwargs):
|
| 1432 |
+
self._interval = interval
|
| 1433 |
+
# Undocumented support for repeat_delay = None as backcompat.
|
| 1434 |
+
self._repeat_delay = repeat_delay if repeat_delay is not None else 0
|
| 1435 |
+
self._repeat = repeat
|
| 1436 |
+
# If we're not given an event source, create a new timer. This permits
|
| 1437 |
+
# sharing timers between animation objects for syncing animations.
|
| 1438 |
+
if event_source is None:
|
| 1439 |
+
event_source = fig.canvas.new_timer(interval=self._interval)
|
| 1440 |
+
super().__init__(fig, event_source=event_source, *args, **kwargs)
|
| 1441 |
+
|
| 1442 |
+
def _step(self, *args):
|
| 1443 |
+
"""Handler for getting events."""
|
| 1444 |
+
# Extends the _step() method for the Animation class. If
|
| 1445 |
+
# Animation._step signals that it reached the end and we want to
|
| 1446 |
+
# repeat, we refresh the frame sequence and return True. If
|
| 1447 |
+
# _repeat_delay is set, change the event_source's interval to our loop
|
| 1448 |
+
# delay and set the callback to one which will then set the interval
|
| 1449 |
+
# back.
|
| 1450 |
+
still_going = super()._step(*args)
|
| 1451 |
+
if not still_going:
|
| 1452 |
+
if self._repeat:
|
| 1453 |
+
# Restart the draw loop
|
| 1454 |
+
self._init_draw()
|
| 1455 |
+
self.frame_seq = self.new_frame_seq()
|
| 1456 |
+
self.event_source.interval = self._repeat_delay
|
| 1457 |
+
return True
|
| 1458 |
+
else:
|
| 1459 |
+
# We are done with the animation. Call pause to remove
|
| 1460 |
+
# animated flags from artists that were using blitting
|
| 1461 |
+
self.pause()
|
| 1462 |
+
if self._blit:
|
| 1463 |
+
# Remove the resize callback if we were blitting
|
| 1464 |
+
self._fig.canvas.mpl_disconnect(self._resize_id)
|
| 1465 |
+
self._fig.canvas.mpl_disconnect(self._close_id)
|
| 1466 |
+
self.event_source = None
|
| 1467 |
+
return False
|
| 1468 |
+
|
| 1469 |
+
self.event_source.interval = self._interval
|
| 1470 |
+
return True
|
| 1471 |
+
|
| 1472 |
+
|
| 1473 |
+
class ArtistAnimation(TimedAnimation):
|
| 1474 |
+
"""
|
| 1475 |
+
`TimedAnimation` subclass that creates an animation by using a fixed
|
| 1476 |
+
set of `.Artist` objects.
|
| 1477 |
+
|
| 1478 |
+
Before creating an instance, all plotting should have taken place
|
| 1479 |
+
and the relevant artists saved.
|
| 1480 |
+
|
| 1481 |
+
.. note::
|
| 1482 |
+
|
| 1483 |
+
You must store the created Animation in a variable that lives as long
|
| 1484 |
+
as the animation should run. Otherwise, the Animation object will be
|
| 1485 |
+
garbage-collected and the animation stops.
|
| 1486 |
+
|
| 1487 |
+
Parameters
|
| 1488 |
+
----------
|
| 1489 |
+
fig : `~matplotlib.figure.Figure`
|
| 1490 |
+
The figure object used to get needed events, such as draw or resize.
|
| 1491 |
+
artists : list
|
| 1492 |
+
Each list entry is a collection of `.Artist` objects that are made
|
| 1493 |
+
visible on the corresponding frame. Other artists are made invisible.
|
| 1494 |
+
interval : int, default: 200
|
| 1495 |
+
Delay between frames in milliseconds.
|
| 1496 |
+
repeat_delay : int, default: 0
|
| 1497 |
+
The delay in milliseconds between consecutive animation runs, if
|
| 1498 |
+
*repeat* is True.
|
| 1499 |
+
repeat : bool, default: True
|
| 1500 |
+
Whether the animation repeats when the sequence of frames is completed.
|
| 1501 |
+
blit : bool, default: False
|
| 1502 |
+
Whether blitting is used to optimize drawing.
|
| 1503 |
+
"""
|
| 1504 |
+
|
| 1505 |
+
def __init__(self, fig, artists, *args, **kwargs):
|
| 1506 |
+
# Internal list of artists drawn in the most recent frame.
|
| 1507 |
+
self._drawn_artists = []
|
| 1508 |
+
|
| 1509 |
+
# Use the list of artists as the framedata, which will be iterated
|
| 1510 |
+
# over by the machinery.
|
| 1511 |
+
self._framedata = artists
|
| 1512 |
+
super().__init__(fig, *args, **kwargs)
|
| 1513 |
+
|
| 1514 |
+
def _init_draw(self):
|
| 1515 |
+
super()._init_draw()
|
| 1516 |
+
# Make all the artists involved in *any* frame invisible
|
| 1517 |
+
figs = set()
|
| 1518 |
+
for f in self.new_frame_seq():
|
| 1519 |
+
for artist in f:
|
| 1520 |
+
artist.set_visible(False)
|
| 1521 |
+
artist.set_animated(self._blit)
|
| 1522 |
+
# Assemble a list of unique figures that need flushing
|
| 1523 |
+
if artist.get_figure() not in figs:
|
| 1524 |
+
figs.add(artist.get_figure())
|
| 1525 |
+
|
| 1526 |
+
# Flush the needed figures
|
| 1527 |
+
for fig in figs:
|
| 1528 |
+
fig.canvas.draw_idle()
|
| 1529 |
+
|
| 1530 |
+
def _pre_draw(self, framedata, blit):
|
| 1531 |
+
"""Clears artists from the last frame."""
|
| 1532 |
+
if blit:
|
| 1533 |
+
# Let blit handle clearing
|
| 1534 |
+
self._blit_clear(self._drawn_artists)
|
| 1535 |
+
else:
|
| 1536 |
+
# Otherwise, make all the artists from the previous frame invisible
|
| 1537 |
+
for artist in self._drawn_artists:
|
| 1538 |
+
artist.set_visible(False)
|
| 1539 |
+
|
| 1540 |
+
def _draw_frame(self, artists):
|
| 1541 |
+
# Save the artists that were passed in as framedata for the other
|
| 1542 |
+
# steps (esp. blitting) to use.
|
| 1543 |
+
self._drawn_artists = artists
|
| 1544 |
+
|
| 1545 |
+
# Make all the artists from the current frame visible
|
| 1546 |
+
for artist in artists:
|
| 1547 |
+
artist.set_visible(True)
|
| 1548 |
+
|
| 1549 |
+
|
| 1550 |
+
class FuncAnimation(TimedAnimation):
|
| 1551 |
+
"""
|
| 1552 |
+
`TimedAnimation` subclass that makes an animation by repeatedly calling
|
| 1553 |
+
a function *func*.
|
| 1554 |
+
|
| 1555 |
+
.. note::
|
| 1556 |
+
|
| 1557 |
+
You must store the created Animation in a variable that lives as long
|
| 1558 |
+
as the animation should run. Otherwise, the Animation object will be
|
| 1559 |
+
garbage-collected and the animation stops.
|
| 1560 |
+
|
| 1561 |
+
Parameters
|
| 1562 |
+
----------
|
| 1563 |
+
fig : `~matplotlib.figure.Figure`
|
| 1564 |
+
The figure object used to get needed events, such as draw or resize.
|
| 1565 |
+
|
| 1566 |
+
func : callable
|
| 1567 |
+
The function to call at each frame. The first argument will
|
| 1568 |
+
be the next value in *frames*. Any additional positional
|
| 1569 |
+
arguments can be supplied using `functools.partial` or via the *fargs*
|
| 1570 |
+
parameter.
|
| 1571 |
+
|
| 1572 |
+
The required signature is::
|
| 1573 |
+
|
| 1574 |
+
def func(frame, *fargs) -> iterable_of_artists
|
| 1575 |
+
|
| 1576 |
+
It is often more convenient to provide the arguments using
|
| 1577 |
+
`functools.partial`. In this way it is also possible to pass keyword
|
| 1578 |
+
arguments. To pass a function with both positional and keyword
|
| 1579 |
+
arguments, set all arguments as keyword arguments, just leaving the
|
| 1580 |
+
*frame* argument unset::
|
| 1581 |
+
|
| 1582 |
+
def func(frame, art, *, y=None):
|
| 1583 |
+
...
|
| 1584 |
+
|
| 1585 |
+
ani = FuncAnimation(fig, partial(func, art=ln, y='foo'))
|
| 1586 |
+
|
| 1587 |
+
If ``blit == True``, *func* must return an iterable of all artists
|
| 1588 |
+
that were modified or created. This information is used by the blitting
|
| 1589 |
+
algorithm to determine which parts of the figure have to be updated.
|
| 1590 |
+
The return value is unused if ``blit == False`` and may be omitted in
|
| 1591 |
+
that case.
|
| 1592 |
+
|
| 1593 |
+
frames : iterable, int, generator function, or None, optional
|
| 1594 |
+
Source of data to pass *func* and each frame of the animation
|
| 1595 |
+
|
| 1596 |
+
- If an iterable, then simply use the values provided. If the
|
| 1597 |
+
iterable has a length, it will override the *save_count* kwarg.
|
| 1598 |
+
|
| 1599 |
+
- If an integer, then equivalent to passing ``range(frames)``
|
| 1600 |
+
|
| 1601 |
+
- If a generator function, then must have the signature::
|
| 1602 |
+
|
| 1603 |
+
def gen_function() -> obj
|
| 1604 |
+
|
| 1605 |
+
- If *None*, then equivalent to passing ``itertools.count``.
|
| 1606 |
+
|
| 1607 |
+
In all of these cases, the values in *frames* is simply passed through
|
| 1608 |
+
to the user-supplied *func* and thus can be of any type.
|
| 1609 |
+
|
| 1610 |
+
init_func : callable, optional
|
| 1611 |
+
A function used to draw a clear frame. If not given, the results of
|
| 1612 |
+
drawing from the first item in the frames sequence will be used. This
|
| 1613 |
+
function will be called once before the first frame.
|
| 1614 |
+
|
| 1615 |
+
The required signature is::
|
| 1616 |
+
|
| 1617 |
+
def init_func() -> iterable_of_artists
|
| 1618 |
+
|
| 1619 |
+
If ``blit == True``, *init_func* must return an iterable of artists
|
| 1620 |
+
to be re-drawn. This information is used by the blitting algorithm to
|
| 1621 |
+
determine which parts of the figure have to be updated. The return
|
| 1622 |
+
value is unused if ``blit == False`` and may be omitted in that case.
|
| 1623 |
+
|
| 1624 |
+
fargs : tuple or None, optional
|
| 1625 |
+
Additional arguments to pass to each call to *func*. Note: the use of
|
| 1626 |
+
`functools.partial` is preferred over *fargs*. See *func* for details.
|
| 1627 |
+
|
| 1628 |
+
save_count : int, optional
|
| 1629 |
+
Fallback for the number of values from *frames* to cache. This is
|
| 1630 |
+
only used if the number of frames cannot be inferred from *frames*,
|
| 1631 |
+
i.e. when it's an iterator without length or a generator.
|
| 1632 |
+
|
| 1633 |
+
interval : int, default: 200
|
| 1634 |
+
Delay between frames in milliseconds.
|
| 1635 |
+
|
| 1636 |
+
repeat_delay : int, default: 0
|
| 1637 |
+
The delay in milliseconds between consecutive animation runs, if
|
| 1638 |
+
*repeat* is True.
|
| 1639 |
+
|
| 1640 |
+
repeat : bool, default: True
|
| 1641 |
+
Whether the animation repeats when the sequence of frames is completed.
|
| 1642 |
+
|
| 1643 |
+
blit : bool, default: False
|
| 1644 |
+
Whether blitting is used to optimize drawing. Note: when using
|
| 1645 |
+
blitting, any animated artists will be drawn according to their zorder;
|
| 1646 |
+
however, they will be drawn on top of any previous artists, regardless
|
| 1647 |
+
of their zorder.
|
| 1648 |
+
|
| 1649 |
+
cache_frame_data : bool, default: True
|
| 1650 |
+
Whether frame data is cached. Disabling cache might be helpful when
|
| 1651 |
+
frames contain large objects.
|
| 1652 |
+
"""
|
| 1653 |
+
def __init__(self, fig, func, frames=None, init_func=None, fargs=None,
|
| 1654 |
+
save_count=None, *, cache_frame_data=True, **kwargs):
|
| 1655 |
+
if fargs:
|
| 1656 |
+
self._args = fargs
|
| 1657 |
+
else:
|
| 1658 |
+
self._args = ()
|
| 1659 |
+
self._func = func
|
| 1660 |
+
self._init_func = init_func
|
| 1661 |
+
|
| 1662 |
+
# Amount of framedata to keep around for saving movies. This is only
|
| 1663 |
+
# used if we don't know how many frames there will be: in the case
|
| 1664 |
+
# of no generator or in the case of a callable.
|
| 1665 |
+
self._save_count = save_count
|
| 1666 |
+
# Set up a function that creates a new iterable when needed. If nothing
|
| 1667 |
+
# is passed in for frames, just use itertools.count, which will just
|
| 1668 |
+
# keep counting from 0. A callable passed in for frames is assumed to
|
| 1669 |
+
# be a generator. An iterable will be used as is, and anything else
|
| 1670 |
+
# will be treated as a number of frames.
|
| 1671 |
+
if frames is None:
|
| 1672 |
+
self._iter_gen = itertools.count
|
| 1673 |
+
elif callable(frames):
|
| 1674 |
+
self._iter_gen = frames
|
| 1675 |
+
elif np.iterable(frames):
|
| 1676 |
+
if kwargs.get('repeat', True):
|
| 1677 |
+
self._tee_from = frames
|
| 1678 |
+
def iter_frames(frames=frames):
|
| 1679 |
+
this, self._tee_from = itertools.tee(self._tee_from, 2)
|
| 1680 |
+
yield from this
|
| 1681 |
+
self._iter_gen = iter_frames
|
| 1682 |
+
else:
|
| 1683 |
+
self._iter_gen = lambda: iter(frames)
|
| 1684 |
+
if hasattr(frames, '__len__'):
|
| 1685 |
+
self._save_count = len(frames)
|
| 1686 |
+
if save_count is not None:
|
| 1687 |
+
_api.warn_external(
|
| 1688 |
+
f"You passed in an explicit {save_count=} "
|
| 1689 |
+
"which is being ignored in favor of "
|
| 1690 |
+
f"{len(frames)=}."
|
| 1691 |
+
)
|
| 1692 |
+
else:
|
| 1693 |
+
self._iter_gen = lambda: iter(range(frames))
|
| 1694 |
+
self._save_count = frames
|
| 1695 |
+
if save_count is not None:
|
| 1696 |
+
_api.warn_external(
|
| 1697 |
+
f"You passed in an explicit {save_count=} which is being "
|
| 1698 |
+
f"ignored in favor of {frames=}."
|
| 1699 |
+
)
|
| 1700 |
+
if self._save_count is None and cache_frame_data:
|
| 1701 |
+
_api.warn_external(
|
| 1702 |
+
f"{frames=!r} which we can infer the length of, "
|
| 1703 |
+
"did not pass an explicit *save_count* "
|
| 1704 |
+
f"and passed {cache_frame_data=}. To avoid a possibly "
|
| 1705 |
+
"unbounded cache, frame data caching has been disabled. "
|
| 1706 |
+
"To suppress this warning either pass "
|
| 1707 |
+
"`cache_frame_data=False` or `save_count=MAX_FRAMES`."
|
| 1708 |
+
)
|
| 1709 |
+
cache_frame_data = False
|
| 1710 |
+
|
| 1711 |
+
self._cache_frame_data = cache_frame_data
|
| 1712 |
+
|
| 1713 |
+
# Needs to be initialized so the draw functions work without checking
|
| 1714 |
+
self._save_seq = []
|
| 1715 |
+
|
| 1716 |
+
super().__init__(fig, **kwargs)
|
| 1717 |
+
|
| 1718 |
+
# Need to reset the saved seq, since right now it will contain data
|
| 1719 |
+
# for a single frame from init, which is not what we want.
|
| 1720 |
+
self._save_seq = []
|
| 1721 |
+
|
| 1722 |
+
def new_frame_seq(self):
|
| 1723 |
+
# Use the generating function to generate a new frame sequence
|
| 1724 |
+
return self._iter_gen()
|
| 1725 |
+
|
| 1726 |
+
def new_saved_frame_seq(self):
|
| 1727 |
+
# Generate an iterator for the sequence of saved data. If there are
|
| 1728 |
+
# no saved frames, generate a new frame sequence and take the first
|
| 1729 |
+
# save_count entries in it.
|
| 1730 |
+
if self._save_seq:
|
| 1731 |
+
# While iterating we are going to update _save_seq
|
| 1732 |
+
# so make a copy to safely iterate over
|
| 1733 |
+
self._old_saved_seq = list(self._save_seq)
|
| 1734 |
+
return iter(self._old_saved_seq)
|
| 1735 |
+
else:
|
| 1736 |
+
if self._save_count is None:
|
| 1737 |
+
frame_seq = self.new_frame_seq()
|
| 1738 |
+
|
| 1739 |
+
def gen():
|
| 1740 |
+
try:
|
| 1741 |
+
while True:
|
| 1742 |
+
yield next(frame_seq)
|
| 1743 |
+
except StopIteration:
|
| 1744 |
+
pass
|
| 1745 |
+
return gen()
|
| 1746 |
+
else:
|
| 1747 |
+
return itertools.islice(self.new_frame_seq(), self._save_count)
|
| 1748 |
+
|
| 1749 |
+
def _init_draw(self):
|
| 1750 |
+
super()._init_draw()
|
| 1751 |
+
# Initialize the drawing either using the given init_func or by
|
| 1752 |
+
# calling the draw function with the first item of the frame sequence.
|
| 1753 |
+
# For blitting, the init_func should return a sequence of modified
|
| 1754 |
+
# artists.
|
| 1755 |
+
if self._init_func is None:
|
| 1756 |
+
try:
|
| 1757 |
+
frame_data = next(self.new_frame_seq())
|
| 1758 |
+
except StopIteration:
|
| 1759 |
+
# we can't start the iteration, it may have already been
|
| 1760 |
+
# exhausted by a previous save or just be 0 length.
|
| 1761 |
+
# warn and bail.
|
| 1762 |
+
warnings.warn(
|
| 1763 |
+
"Can not start iterating the frames for the initial draw. "
|
| 1764 |
+
"This can be caused by passing in a 0 length sequence "
|
| 1765 |
+
"for *frames*.\n\n"
|
| 1766 |
+
"If you passed *frames* as a generator "
|
| 1767 |
+
"it may be exhausted due to a previous display or save."
|
| 1768 |
+
)
|
| 1769 |
+
return
|
| 1770 |
+
self._draw_frame(frame_data)
|
| 1771 |
+
else:
|
| 1772 |
+
self._drawn_artists = self._init_func()
|
| 1773 |
+
if self._blit:
|
| 1774 |
+
if self._drawn_artists is None:
|
| 1775 |
+
raise RuntimeError('The init_func must return a '
|
| 1776 |
+
'sequence of Artist objects.')
|
| 1777 |
+
for a in self._drawn_artists:
|
| 1778 |
+
a.set_animated(self._blit)
|
| 1779 |
+
self._save_seq = []
|
| 1780 |
+
|
| 1781 |
+
def _draw_frame(self, framedata):
|
| 1782 |
+
if self._cache_frame_data:
|
| 1783 |
+
# Save the data for potential saving of movies.
|
| 1784 |
+
self._save_seq.append(framedata)
|
| 1785 |
+
self._save_seq = self._save_seq[-self._save_count:]
|
| 1786 |
+
|
| 1787 |
+
# Call the func with framedata and args. If blitting is desired,
|
| 1788 |
+
# func needs to return a sequence of any artists that were modified.
|
| 1789 |
+
self._drawn_artists = self._func(framedata, *self._args)
|
| 1790 |
+
|
| 1791 |
+
if self._blit:
|
| 1792 |
+
|
| 1793 |
+
err = RuntimeError('The animation function must return a sequence '
|
| 1794 |
+
'of Artist objects.')
|
| 1795 |
+
try:
|
| 1796 |
+
# check if a sequence
|
| 1797 |
+
iter(self._drawn_artists)
|
| 1798 |
+
except TypeError:
|
| 1799 |
+
raise err from None
|
| 1800 |
+
|
| 1801 |
+
# check each item if it's artist
|
| 1802 |
+
for i in self._drawn_artists:
|
| 1803 |
+
if not isinstance(i, mpl.artist.Artist):
|
| 1804 |
+
raise err
|
| 1805 |
+
|
| 1806 |
+
self._drawn_artists = sorted(self._drawn_artists,
|
| 1807 |
+
key=lambda x: x.get_zorder())
|
| 1808 |
+
|
| 1809 |
+
for a in self._drawn_artists:
|
| 1810 |
+
a.set_animated(self._blit)
|
| 1811 |
+
|
| 1812 |
+
|
| 1813 |
+
def _validate_grabframe_kwargs(savefig_kwargs):
|
| 1814 |
+
if mpl.rcParams['savefig.bbox'] == 'tight':
|
| 1815 |
+
raise ValueError(
|
| 1816 |
+
f"{mpl.rcParams['savefig.bbox']=} must not be 'tight' as it "
|
| 1817 |
+
"may cause frame size to vary, which is inappropriate for animation."
|
| 1818 |
+
)
|
| 1819 |
+
for k in ('dpi', 'bbox_inches', 'format'):
|
| 1820 |
+
if k in savefig_kwargs:
|
| 1821 |
+
raise TypeError(
|
| 1822 |
+
f"grab_frame got an unexpected keyword argument {k!r}"
|
| 1823 |
+
)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/animation.pyi
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import abc
|
| 2 |
+
from collections.abc import Callable, Collection, Iterable, Sequence, Generator
|
| 3 |
+
import contextlib
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from matplotlib.artist import Artist
|
| 6 |
+
from matplotlib.backend_bases import TimerBase
|
| 7 |
+
from matplotlib.figure import Figure
|
| 8 |
+
|
| 9 |
+
from typing import Any
|
| 10 |
+
|
| 11 |
+
subprocess_creation_flags: int
|
| 12 |
+
|
| 13 |
+
def adjusted_figsize(w: float, h: float, dpi: float, n: int) -> tuple[float, float]: ...
|
| 14 |
+
|
| 15 |
+
class MovieWriterRegistry:
|
| 16 |
+
def __init__(self) -> None: ...
|
| 17 |
+
def register(
|
| 18 |
+
self, name: str
|
| 19 |
+
) -> Callable[[type[AbstractMovieWriter]], type[AbstractMovieWriter]]: ...
|
| 20 |
+
def is_available(self, name: str) -> bool: ...
|
| 21 |
+
def __iter__(self) -> Generator[str, None, None]: ...
|
| 22 |
+
def list(self) -> list[str]: ...
|
| 23 |
+
def __getitem__(self, name: str) -> type[AbstractMovieWriter]: ...
|
| 24 |
+
|
| 25 |
+
writers: MovieWriterRegistry
|
| 26 |
+
|
| 27 |
+
class AbstractMovieWriter(abc.ABC, metaclass=abc.ABCMeta):
|
| 28 |
+
fps: int
|
| 29 |
+
metadata: dict[str, str]
|
| 30 |
+
codec: str
|
| 31 |
+
bitrate: int
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
fps: int = ...,
|
| 35 |
+
metadata: dict[str, str] | None = ...,
|
| 36 |
+
codec: str | None = ...,
|
| 37 |
+
bitrate: int | None = ...,
|
| 38 |
+
) -> None: ...
|
| 39 |
+
outfile: str | Path
|
| 40 |
+
fig: Figure
|
| 41 |
+
dpi: float
|
| 42 |
+
|
| 43 |
+
@abc.abstractmethod
|
| 44 |
+
def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
|
| 45 |
+
@property
|
| 46 |
+
def frame_size(self) -> tuple[int, int]: ...
|
| 47 |
+
@abc.abstractmethod
|
| 48 |
+
def grab_frame(self, **savefig_kwargs) -> None: ...
|
| 49 |
+
@abc.abstractmethod
|
| 50 |
+
def finish(self) -> None: ...
|
| 51 |
+
@contextlib.contextmanager
|
| 52 |
+
def saving(
|
| 53 |
+
self, fig: Figure, outfile: str | Path, dpi: float | None, *args, **kwargs
|
| 54 |
+
) -> Generator[AbstractMovieWriter, None, None]: ...
|
| 55 |
+
|
| 56 |
+
class MovieWriter(AbstractMovieWriter):
|
| 57 |
+
supported_formats: list[str]
|
| 58 |
+
frame_format: str
|
| 59 |
+
extra_args: list[str] | None
|
| 60 |
+
def __init__(
|
| 61 |
+
self,
|
| 62 |
+
fps: int = ...,
|
| 63 |
+
codec: str | None = ...,
|
| 64 |
+
bitrate: int | None = ...,
|
| 65 |
+
extra_args: list[str] | None = ...,
|
| 66 |
+
metadata: dict[str, str] | None = ...,
|
| 67 |
+
) -> None: ...
|
| 68 |
+
def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
|
| 69 |
+
def grab_frame(self, **savefig_kwargs) -> None: ...
|
| 70 |
+
def finish(self) -> None: ...
|
| 71 |
+
@classmethod
|
| 72 |
+
def bin_path(cls) -> str: ...
|
| 73 |
+
@classmethod
|
| 74 |
+
def isAvailable(cls) -> bool: ...
|
| 75 |
+
|
| 76 |
+
class FileMovieWriter(MovieWriter):
|
| 77 |
+
fig: Figure
|
| 78 |
+
outfile: str | Path
|
| 79 |
+
dpi: float
|
| 80 |
+
temp_prefix: str
|
| 81 |
+
fname_format_str: str
|
| 82 |
+
def setup(
|
| 83 |
+
self,
|
| 84 |
+
fig: Figure,
|
| 85 |
+
outfile: str | Path,
|
| 86 |
+
dpi: float | None = ...,
|
| 87 |
+
frame_prefix: str | Path | None = ...,
|
| 88 |
+
) -> None: ...
|
| 89 |
+
def __del__(self) -> None: ...
|
| 90 |
+
@property
|
| 91 |
+
def frame_format(self) -> str: ...
|
| 92 |
+
@frame_format.setter
|
| 93 |
+
def frame_format(self, frame_format: str) -> None: ...
|
| 94 |
+
|
| 95 |
+
class PillowWriter(AbstractMovieWriter):
|
| 96 |
+
@classmethod
|
| 97 |
+
def isAvailable(cls) -> bool: ...
|
| 98 |
+
def setup(
|
| 99 |
+
self, fig: Figure, outfile: str | Path, dpi: float | None = ...
|
| 100 |
+
) -> None: ...
|
| 101 |
+
def grab_frame(self, **savefig_kwargs) -> None: ...
|
| 102 |
+
def finish(self) -> None: ...
|
| 103 |
+
|
| 104 |
+
class FFMpegBase:
|
| 105 |
+
codec: str
|
| 106 |
+
@property
|
| 107 |
+
def output_args(self) -> list[str]: ...
|
| 108 |
+
|
| 109 |
+
class FFMpegWriter(FFMpegBase, MovieWriter): ...
|
| 110 |
+
|
| 111 |
+
class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
|
| 112 |
+
supported_formats: list[str]
|
| 113 |
+
|
| 114 |
+
class ImageMagickBase:
|
| 115 |
+
@classmethod
|
| 116 |
+
def bin_path(cls) -> str: ...
|
| 117 |
+
@classmethod
|
| 118 |
+
def isAvailable(cls) -> bool: ...
|
| 119 |
+
|
| 120 |
+
class ImageMagickWriter(ImageMagickBase, MovieWriter):
|
| 121 |
+
input_names: str
|
| 122 |
+
|
| 123 |
+
class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
|
| 124 |
+
supported_formats: list[str]
|
| 125 |
+
@property
|
| 126 |
+
def input_names(self) -> str: ...
|
| 127 |
+
|
| 128 |
+
class HTMLWriter(FileMovieWriter):
|
| 129 |
+
supported_formats: list[str]
|
| 130 |
+
@classmethod
|
| 131 |
+
def isAvailable(cls) -> bool: ...
|
| 132 |
+
embed_frames: bool
|
| 133 |
+
default_mode: str
|
| 134 |
+
def __init__(
|
| 135 |
+
self,
|
| 136 |
+
fps: int = ...,
|
| 137 |
+
codec: str | None = ...,
|
| 138 |
+
bitrate: int | None = ...,
|
| 139 |
+
extra_args: list[str] | None = ...,
|
| 140 |
+
metadata: dict[str, str] | None = ...,
|
| 141 |
+
embed_frames: bool = ...,
|
| 142 |
+
default_mode: str = ...,
|
| 143 |
+
embed_limit: float | None = ...,
|
| 144 |
+
) -> None: ...
|
| 145 |
+
def setup(
|
| 146 |
+
self,
|
| 147 |
+
fig: Figure,
|
| 148 |
+
outfile: str | Path,
|
| 149 |
+
dpi: float | None = ...,
|
| 150 |
+
frame_dir: str | Path | None = ...,
|
| 151 |
+
) -> None: ...
|
| 152 |
+
def grab_frame(self, **savefig_kwargs): ...
|
| 153 |
+
def finish(self) -> None: ...
|
| 154 |
+
|
| 155 |
+
class Animation:
|
| 156 |
+
frame_seq: Iterable[Artist]
|
| 157 |
+
event_source: Any
|
| 158 |
+
def __init__(
|
| 159 |
+
self, fig: Figure, event_source: Any | None = ..., blit: bool = ...
|
| 160 |
+
) -> None: ...
|
| 161 |
+
def __del__(self) -> None: ...
|
| 162 |
+
def save(
|
| 163 |
+
self,
|
| 164 |
+
filename: str | Path,
|
| 165 |
+
writer: AbstractMovieWriter | str | None = ...,
|
| 166 |
+
fps: int | None = ...,
|
| 167 |
+
dpi: float | None = ...,
|
| 168 |
+
codec: str | None = ...,
|
| 169 |
+
bitrate: int | None = ...,
|
| 170 |
+
extra_args: list[str] | None = ...,
|
| 171 |
+
metadata: dict[str, str] | None = ...,
|
| 172 |
+
extra_anim: list[Animation] | None = ...,
|
| 173 |
+
savefig_kwargs: dict[str, Any] | None = ...,
|
| 174 |
+
*,
|
| 175 |
+
progress_callback: Callable[[int, int], Any] | None = ...
|
| 176 |
+
) -> None: ...
|
| 177 |
+
def new_frame_seq(self) -> Iterable[Artist]: ...
|
| 178 |
+
def new_saved_frame_seq(self) -> Iterable[Artist]: ...
|
| 179 |
+
def to_html5_video(self, embed_limit: float | None = ...) -> str: ...
|
| 180 |
+
def to_jshtml(
|
| 181 |
+
self,
|
| 182 |
+
fps: int | None = ...,
|
| 183 |
+
embed_frames: bool = ...,
|
| 184 |
+
default_mode: str | None = ...,
|
| 185 |
+
) -> str: ...
|
| 186 |
+
def _repr_html_(self) -> str: ...
|
| 187 |
+
def pause(self) -> None: ...
|
| 188 |
+
def resume(self) -> None: ...
|
| 189 |
+
|
| 190 |
+
class TimedAnimation(Animation):
|
| 191 |
+
def __init__(
|
| 192 |
+
self,
|
| 193 |
+
fig: Figure,
|
| 194 |
+
interval: int = ...,
|
| 195 |
+
repeat_delay: int = ...,
|
| 196 |
+
repeat: bool = ...,
|
| 197 |
+
event_source: TimerBase | None = ...,
|
| 198 |
+
*args,
|
| 199 |
+
**kwargs
|
| 200 |
+
) -> None: ...
|
| 201 |
+
|
| 202 |
+
class ArtistAnimation(TimedAnimation):
|
| 203 |
+
def __init__(self, fig: Figure, artists: Sequence[Collection[Artist]], *args, **kwargs) -> None: ...
|
| 204 |
+
|
| 205 |
+
class FuncAnimation(TimedAnimation):
|
| 206 |
+
def __init__(
|
| 207 |
+
self,
|
| 208 |
+
fig: Figure,
|
| 209 |
+
func: Callable[..., Iterable[Artist]],
|
| 210 |
+
frames: Iterable | int | Callable[[], Generator] | None = ...,
|
| 211 |
+
init_func: Callable[[], Iterable[Artist]] | None = ...,
|
| 212 |
+
fargs: tuple[Any, ...] | None = ...,
|
| 213 |
+
save_count: int | None = ...,
|
| 214 |
+
*,
|
| 215 |
+
cache_frame_data: bool = ...,
|
| 216 |
+
**kwargs
|
| 217 |
+
) -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/artist.py
ADDED
|
@@ -0,0 +1,1855 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import namedtuple
|
| 2 |
+
import contextlib
|
| 3 |
+
from functools import cache, reduce, wraps
|
| 4 |
+
import inspect
|
| 5 |
+
from inspect import Signature, Parameter
|
| 6 |
+
import logging
|
| 7 |
+
from numbers import Number, Real
|
| 8 |
+
import operator
|
| 9 |
+
import re
|
| 10 |
+
import warnings
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
|
| 14 |
+
import matplotlib as mpl
|
| 15 |
+
from . import _api, cbook
|
| 16 |
+
from .path import Path
|
| 17 |
+
from .transforms import (BboxBase, Bbox, IdentityTransform, Transform, TransformedBbox,
|
| 18 |
+
TransformedPatchPath, TransformedPath)
|
| 19 |
+
|
| 20 |
+
_log = logging.getLogger(__name__)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def _prevent_rasterization(draw):
|
| 24 |
+
# We assume that by default artists are not allowed to rasterize (unless
|
| 25 |
+
# its draw method is explicitly decorated). If it is being drawn after a
|
| 26 |
+
# rasterized artist and it has reached a raster_depth of 0, we stop
|
| 27 |
+
# rasterization so that it does not affect the behavior of normal artist
|
| 28 |
+
# (e.g., change in dpi).
|
| 29 |
+
|
| 30 |
+
@wraps(draw)
|
| 31 |
+
def draw_wrapper(artist, renderer, *args, **kwargs):
|
| 32 |
+
if renderer._raster_depth == 0 and renderer._rasterizing:
|
| 33 |
+
# Only stop when we are not in a rasterized parent
|
| 34 |
+
# and something has been rasterized since last stop.
|
| 35 |
+
renderer.stop_rasterizing()
|
| 36 |
+
renderer._rasterizing = False
|
| 37 |
+
|
| 38 |
+
return draw(artist, renderer, *args, **kwargs)
|
| 39 |
+
|
| 40 |
+
draw_wrapper._supports_rasterization = False
|
| 41 |
+
return draw_wrapper
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def allow_rasterization(draw):
|
| 45 |
+
"""
|
| 46 |
+
Decorator for Artist.draw method. Provides routines
|
| 47 |
+
that run before and after the draw call. The before and after functions
|
| 48 |
+
are useful for changing artist-dependent renderer attributes or making
|
| 49 |
+
other setup function calls, such as starting and flushing a mixed-mode
|
| 50 |
+
renderer.
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
@wraps(draw)
|
| 54 |
+
def draw_wrapper(artist, renderer):
|
| 55 |
+
try:
|
| 56 |
+
if artist.get_rasterized():
|
| 57 |
+
if renderer._raster_depth == 0 and not renderer._rasterizing:
|
| 58 |
+
renderer.start_rasterizing()
|
| 59 |
+
renderer._rasterizing = True
|
| 60 |
+
renderer._raster_depth += 1
|
| 61 |
+
else:
|
| 62 |
+
if renderer._raster_depth == 0 and renderer._rasterizing:
|
| 63 |
+
# Only stop when we are not in a rasterized parent
|
| 64 |
+
# and something has be rasterized since last stop
|
| 65 |
+
renderer.stop_rasterizing()
|
| 66 |
+
renderer._rasterizing = False
|
| 67 |
+
|
| 68 |
+
if artist.get_agg_filter() is not None:
|
| 69 |
+
renderer.start_filter()
|
| 70 |
+
|
| 71 |
+
return draw(artist, renderer)
|
| 72 |
+
finally:
|
| 73 |
+
if artist.get_agg_filter() is not None:
|
| 74 |
+
renderer.stop_filter(artist.get_agg_filter())
|
| 75 |
+
if artist.get_rasterized():
|
| 76 |
+
renderer._raster_depth -= 1
|
| 77 |
+
if (renderer._rasterizing and (fig := artist.get_figure(root=True)) and
|
| 78 |
+
fig.suppressComposite):
|
| 79 |
+
# restart rasterizing to prevent merging
|
| 80 |
+
renderer.stop_rasterizing()
|
| 81 |
+
renderer.start_rasterizing()
|
| 82 |
+
|
| 83 |
+
draw_wrapper._supports_rasterization = True
|
| 84 |
+
return draw_wrapper
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _finalize_rasterization(draw):
|
| 88 |
+
"""
|
| 89 |
+
Decorator for Artist.draw method. Needed on the outermost artist, i.e.
|
| 90 |
+
Figure, to finish up if the render is still in rasterized mode.
|
| 91 |
+
"""
|
| 92 |
+
@wraps(draw)
|
| 93 |
+
def draw_wrapper(artist, renderer, *args, **kwargs):
|
| 94 |
+
result = draw(artist, renderer, *args, **kwargs)
|
| 95 |
+
if renderer._rasterizing:
|
| 96 |
+
renderer.stop_rasterizing()
|
| 97 |
+
renderer._rasterizing = False
|
| 98 |
+
return result
|
| 99 |
+
return draw_wrapper
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def _stale_axes_callback(self, val):
|
| 103 |
+
if self.axes:
|
| 104 |
+
self.axes.stale = val
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
_XYPair = namedtuple("_XYPair", "x y")
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
class _Unset:
|
| 111 |
+
def __repr__(self):
|
| 112 |
+
return "<UNSET>"
|
| 113 |
+
_UNSET = _Unset()
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class Artist:
|
| 117 |
+
"""
|
| 118 |
+
Abstract base class for objects that render into a FigureCanvas.
|
| 119 |
+
|
| 120 |
+
Typically, all visible elements in a figure are subclasses of Artist.
|
| 121 |
+
"""
|
| 122 |
+
|
| 123 |
+
zorder = 0
|
| 124 |
+
|
| 125 |
+
def __init_subclass__(cls):
|
| 126 |
+
|
| 127 |
+
# Decorate draw() method so that all artists are able to stop
|
| 128 |
+
# rastrization when necessary. If the artist's draw method is already
|
| 129 |
+
# decorated (has a `_supports_rasterization` attribute), it won't be
|
| 130 |
+
# decorated.
|
| 131 |
+
|
| 132 |
+
if not hasattr(cls.draw, "_supports_rasterization"):
|
| 133 |
+
cls.draw = _prevent_rasterization(cls.draw)
|
| 134 |
+
|
| 135 |
+
# Inject custom set() methods into the subclass with signature and
|
| 136 |
+
# docstring based on the subclasses' properties.
|
| 137 |
+
|
| 138 |
+
if not hasattr(cls.set, '_autogenerated_signature'):
|
| 139 |
+
# Don't overwrite cls.set if the subclass or one of its parents
|
| 140 |
+
# has defined a set method set itself.
|
| 141 |
+
# If there was no explicit definition, cls.set is inherited from
|
| 142 |
+
# the hierarchy of auto-generated set methods, which hold the
|
| 143 |
+
# flag _autogenerated_signature.
|
| 144 |
+
return
|
| 145 |
+
|
| 146 |
+
cls.set = lambda self, **kwargs: Artist.set(self, **kwargs)
|
| 147 |
+
cls.set.__name__ = "set"
|
| 148 |
+
cls.set.__qualname__ = f"{cls.__qualname__}.set"
|
| 149 |
+
cls._update_set_signature_and_docstring()
|
| 150 |
+
|
| 151 |
+
_PROPERTIES_EXCLUDED_FROM_SET = [
|
| 152 |
+
'navigate_mode', # not a user-facing function
|
| 153 |
+
'figure', # changing the figure is such a profound operation
|
| 154 |
+
# that we don't want this in set()
|
| 155 |
+
'3d_properties', # cannot be used as a keyword due to leading digit
|
| 156 |
+
]
|
| 157 |
+
|
| 158 |
+
@classmethod
|
| 159 |
+
def _update_set_signature_and_docstring(cls):
|
| 160 |
+
"""
|
| 161 |
+
Update the signature of the set function to list all properties
|
| 162 |
+
as keyword arguments.
|
| 163 |
+
|
| 164 |
+
Property aliases are not listed in the signature for brevity, but
|
| 165 |
+
are still accepted as keyword arguments.
|
| 166 |
+
"""
|
| 167 |
+
cls.set.__signature__ = Signature(
|
| 168 |
+
[Parameter("self", Parameter.POSITIONAL_OR_KEYWORD),
|
| 169 |
+
*[Parameter(prop, Parameter.KEYWORD_ONLY, default=_UNSET)
|
| 170 |
+
for prop in ArtistInspector(cls).get_setters()
|
| 171 |
+
if prop not in Artist._PROPERTIES_EXCLUDED_FROM_SET]])
|
| 172 |
+
cls.set._autogenerated_signature = True
|
| 173 |
+
|
| 174 |
+
cls.set.__doc__ = (
|
| 175 |
+
"Set multiple properties at once.\n\n"
|
| 176 |
+
"Supported properties are\n\n"
|
| 177 |
+
+ kwdoc(cls))
|
| 178 |
+
|
| 179 |
+
def __init__(self):
|
| 180 |
+
self._stale = True
|
| 181 |
+
self.stale_callback = None
|
| 182 |
+
self._axes = None
|
| 183 |
+
self._parent_figure = None
|
| 184 |
+
|
| 185 |
+
self._transform = None
|
| 186 |
+
self._transformSet = False
|
| 187 |
+
self._visible = True
|
| 188 |
+
self._animated = False
|
| 189 |
+
self._alpha = None
|
| 190 |
+
self.clipbox = None
|
| 191 |
+
self._clippath = None
|
| 192 |
+
self._clipon = True
|
| 193 |
+
self._label = ''
|
| 194 |
+
self._picker = None
|
| 195 |
+
self._rasterized = False
|
| 196 |
+
self._agg_filter = None
|
| 197 |
+
# Normally, artist classes need to be queried for mouseover info if and
|
| 198 |
+
# only if they override get_cursor_data.
|
| 199 |
+
self._mouseover = type(self).get_cursor_data != Artist.get_cursor_data
|
| 200 |
+
self._callbacks = cbook.CallbackRegistry(signals=["pchanged"])
|
| 201 |
+
try:
|
| 202 |
+
self.axes = None
|
| 203 |
+
except AttributeError:
|
| 204 |
+
# Handle self.axes as a read-only property, as in Figure.
|
| 205 |
+
pass
|
| 206 |
+
self._remove_method = None
|
| 207 |
+
self._url = None
|
| 208 |
+
self._gid = None
|
| 209 |
+
self._snap = None
|
| 210 |
+
self._sketch = mpl.rcParams['path.sketch']
|
| 211 |
+
self._path_effects = mpl.rcParams['path.effects']
|
| 212 |
+
self._sticky_edges = _XYPair([], [])
|
| 213 |
+
self._in_layout = True
|
| 214 |
+
|
| 215 |
+
def __getstate__(self):
|
| 216 |
+
d = self.__dict__.copy()
|
| 217 |
+
d['stale_callback'] = None
|
| 218 |
+
return d
|
| 219 |
+
|
| 220 |
+
def remove(self):
|
| 221 |
+
"""
|
| 222 |
+
Remove the artist from the figure if possible.
|
| 223 |
+
|
| 224 |
+
The effect will not be visible until the figure is redrawn, e.g.,
|
| 225 |
+
with `.FigureCanvasBase.draw_idle`. Call `~.axes.Axes.relim` to
|
| 226 |
+
update the Axes limits if desired.
|
| 227 |
+
|
| 228 |
+
Note: `~.axes.Axes.relim` will not see collections even if the
|
| 229 |
+
collection was added to the Axes with *autolim* = True.
|
| 230 |
+
|
| 231 |
+
Note: there is no support for removing the artist's legend entry.
|
| 232 |
+
"""
|
| 233 |
+
|
| 234 |
+
# There is no method to set the callback. Instead, the parent should
|
| 235 |
+
# set the _remove_method attribute directly. This would be a
|
| 236 |
+
# protected attribute if Python supported that sort of thing. The
|
| 237 |
+
# callback has one parameter, which is the child to be removed.
|
| 238 |
+
if self._remove_method is not None:
|
| 239 |
+
self._remove_method(self)
|
| 240 |
+
# clear stale callback
|
| 241 |
+
self.stale_callback = None
|
| 242 |
+
_ax_flag = False
|
| 243 |
+
if hasattr(self, 'axes') and self.axes:
|
| 244 |
+
# remove from the mouse hit list
|
| 245 |
+
self.axes._mouseover_set.discard(self)
|
| 246 |
+
self.axes.stale = True
|
| 247 |
+
self.axes = None # decouple the artist from the Axes
|
| 248 |
+
_ax_flag = True
|
| 249 |
+
|
| 250 |
+
if (fig := self.get_figure(root=False)) is not None:
|
| 251 |
+
if not _ax_flag:
|
| 252 |
+
fig.stale = True
|
| 253 |
+
self._parent_figure = None
|
| 254 |
+
|
| 255 |
+
else:
|
| 256 |
+
raise NotImplementedError('cannot remove artist')
|
| 257 |
+
# TODO: the fix for the collections relim problem is to move the
|
| 258 |
+
# limits calculation into the artist itself, including the property of
|
| 259 |
+
# whether or not the artist should affect the limits. Then there will
|
| 260 |
+
# be no distinction between axes.add_line, axes.add_patch, etc.
|
| 261 |
+
# TODO: add legend support
|
| 262 |
+
|
| 263 |
+
def have_units(self):
|
| 264 |
+
"""Return whether units are set on any axis."""
|
| 265 |
+
ax = self.axes
|
| 266 |
+
return ax and any(axis.have_units() for axis in ax._axis_map.values())
|
| 267 |
+
|
| 268 |
+
def convert_xunits(self, x):
|
| 269 |
+
"""
|
| 270 |
+
Convert *x* using the unit type of the xaxis.
|
| 271 |
+
|
| 272 |
+
If the artist is not contained in an Axes or if the xaxis does not
|
| 273 |
+
have units, *x* itself is returned.
|
| 274 |
+
"""
|
| 275 |
+
ax = getattr(self, 'axes', None)
|
| 276 |
+
if ax is None or ax.xaxis is None:
|
| 277 |
+
return x
|
| 278 |
+
return ax.xaxis.convert_units(x)
|
| 279 |
+
|
| 280 |
+
def convert_yunits(self, y):
|
| 281 |
+
"""
|
| 282 |
+
Convert *y* using the unit type of the yaxis.
|
| 283 |
+
|
| 284 |
+
If the artist is not contained in an Axes or if the yaxis does not
|
| 285 |
+
have units, *y* itself is returned.
|
| 286 |
+
"""
|
| 287 |
+
ax = getattr(self, 'axes', None)
|
| 288 |
+
if ax is None or ax.yaxis is None:
|
| 289 |
+
return y
|
| 290 |
+
return ax.yaxis.convert_units(y)
|
| 291 |
+
|
| 292 |
+
@property
|
| 293 |
+
def axes(self):
|
| 294 |
+
"""The `~.axes.Axes` instance the artist resides in, or *None*."""
|
| 295 |
+
return self._axes
|
| 296 |
+
|
| 297 |
+
@axes.setter
|
| 298 |
+
def axes(self, new_axes):
|
| 299 |
+
if (new_axes is not None and self._axes is not None
|
| 300 |
+
and new_axes != self._axes):
|
| 301 |
+
raise ValueError("Can not reset the Axes. You are probably trying to reuse "
|
| 302 |
+
"an artist in more than one Axes which is not supported")
|
| 303 |
+
self._axes = new_axes
|
| 304 |
+
if new_axes is not None and new_axes is not self:
|
| 305 |
+
self.stale_callback = _stale_axes_callback
|
| 306 |
+
|
| 307 |
+
@property
|
| 308 |
+
def stale(self):
|
| 309 |
+
"""
|
| 310 |
+
Whether the artist is 'stale' and needs to be re-drawn for the output
|
| 311 |
+
to match the internal state of the artist.
|
| 312 |
+
"""
|
| 313 |
+
return self._stale
|
| 314 |
+
|
| 315 |
+
@stale.setter
|
| 316 |
+
def stale(self, val):
|
| 317 |
+
self._stale = val
|
| 318 |
+
|
| 319 |
+
# if the artist is animated it does not take normal part in the
|
| 320 |
+
# draw stack and is not expected to be drawn as part of the normal
|
| 321 |
+
# draw loop (when not saving) so do not propagate this change
|
| 322 |
+
if self._animated:
|
| 323 |
+
return
|
| 324 |
+
|
| 325 |
+
if val and self.stale_callback is not None:
|
| 326 |
+
self.stale_callback(self, val)
|
| 327 |
+
|
| 328 |
+
def get_window_extent(self, renderer=None):
|
| 329 |
+
"""
|
| 330 |
+
Get the artist's bounding box in display space.
|
| 331 |
+
|
| 332 |
+
The bounding box' width and height are nonnegative.
|
| 333 |
+
|
| 334 |
+
Subclasses should override for inclusion in the bounding box
|
| 335 |
+
"tight" calculation. Default is to return an empty bounding
|
| 336 |
+
box at 0, 0.
|
| 337 |
+
|
| 338 |
+
Be careful when using this function, the results will not update
|
| 339 |
+
if the artist window extent of the artist changes. The extent
|
| 340 |
+
can change due to any changes in the transform stack, such as
|
| 341 |
+
changing the Axes limits, the figure size, or the canvas used
|
| 342 |
+
(as is done when saving a figure). This can lead to unexpected
|
| 343 |
+
behavior where interactive figures will look fine on the screen,
|
| 344 |
+
but will save incorrectly.
|
| 345 |
+
"""
|
| 346 |
+
return Bbox([[0, 0], [0, 0]])
|
| 347 |
+
|
| 348 |
+
def get_tightbbox(self, renderer=None):
|
| 349 |
+
"""
|
| 350 |
+
Like `.Artist.get_window_extent`, but includes any clipping.
|
| 351 |
+
|
| 352 |
+
Parameters
|
| 353 |
+
----------
|
| 354 |
+
renderer : `~matplotlib.backend_bases.RendererBase` subclass, optional
|
| 355 |
+
renderer that will be used to draw the figures (i.e.
|
| 356 |
+
``fig.canvas.get_renderer()``)
|
| 357 |
+
|
| 358 |
+
Returns
|
| 359 |
+
-------
|
| 360 |
+
`.Bbox` or None
|
| 361 |
+
The enclosing bounding box (in figure pixel coordinates).
|
| 362 |
+
Returns None if clipping results in no intersection.
|
| 363 |
+
"""
|
| 364 |
+
bbox = self.get_window_extent(renderer)
|
| 365 |
+
if self.get_clip_on():
|
| 366 |
+
clip_box = self.get_clip_box()
|
| 367 |
+
if clip_box is not None:
|
| 368 |
+
bbox = Bbox.intersection(bbox, clip_box)
|
| 369 |
+
clip_path = self.get_clip_path()
|
| 370 |
+
if clip_path is not None and bbox is not None:
|
| 371 |
+
clip_path = clip_path.get_fully_transformed_path()
|
| 372 |
+
bbox = Bbox.intersection(bbox, clip_path.get_extents())
|
| 373 |
+
return bbox
|
| 374 |
+
|
| 375 |
+
def add_callback(self, func):
|
| 376 |
+
"""
|
| 377 |
+
Add a callback function that will be called whenever one of the
|
| 378 |
+
`.Artist`'s properties changes.
|
| 379 |
+
|
| 380 |
+
Parameters
|
| 381 |
+
----------
|
| 382 |
+
func : callable
|
| 383 |
+
The callback function. It must have the signature::
|
| 384 |
+
|
| 385 |
+
def func(artist: Artist) -> Any
|
| 386 |
+
|
| 387 |
+
where *artist* is the calling `.Artist`. Return values may exist
|
| 388 |
+
but are ignored.
|
| 389 |
+
|
| 390 |
+
Returns
|
| 391 |
+
-------
|
| 392 |
+
int
|
| 393 |
+
The observer id associated with the callback. This id can be
|
| 394 |
+
used for removing the callback with `.remove_callback` later.
|
| 395 |
+
|
| 396 |
+
See Also
|
| 397 |
+
--------
|
| 398 |
+
remove_callback
|
| 399 |
+
"""
|
| 400 |
+
# Wrapping func in a lambda ensures it can be connected multiple times
|
| 401 |
+
# and never gets weakref-gc'ed.
|
| 402 |
+
return self._callbacks.connect("pchanged", lambda: func(self))
|
| 403 |
+
|
| 404 |
+
def remove_callback(self, oid):
|
| 405 |
+
"""
|
| 406 |
+
Remove a callback based on its observer id.
|
| 407 |
+
|
| 408 |
+
See Also
|
| 409 |
+
--------
|
| 410 |
+
add_callback
|
| 411 |
+
"""
|
| 412 |
+
self._callbacks.disconnect(oid)
|
| 413 |
+
|
| 414 |
+
def pchanged(self):
|
| 415 |
+
"""
|
| 416 |
+
Call all of the registered callbacks.
|
| 417 |
+
|
| 418 |
+
This function is triggered internally when a property is changed.
|
| 419 |
+
|
| 420 |
+
See Also
|
| 421 |
+
--------
|
| 422 |
+
add_callback
|
| 423 |
+
remove_callback
|
| 424 |
+
"""
|
| 425 |
+
self._callbacks.process("pchanged")
|
| 426 |
+
|
| 427 |
+
def is_transform_set(self):
|
| 428 |
+
"""
|
| 429 |
+
Return whether the Artist has an explicitly set transform.
|
| 430 |
+
|
| 431 |
+
This is *True* after `.set_transform` has been called.
|
| 432 |
+
"""
|
| 433 |
+
return self._transformSet
|
| 434 |
+
|
| 435 |
+
def set_transform(self, t):
|
| 436 |
+
"""
|
| 437 |
+
Set the artist transform.
|
| 438 |
+
|
| 439 |
+
Parameters
|
| 440 |
+
----------
|
| 441 |
+
t : `~matplotlib.transforms.Transform`
|
| 442 |
+
"""
|
| 443 |
+
self._transform = t
|
| 444 |
+
self._transformSet = True
|
| 445 |
+
self.pchanged()
|
| 446 |
+
self.stale = True
|
| 447 |
+
|
| 448 |
+
def get_transform(self):
|
| 449 |
+
"""Return the `.Transform` instance used by this artist."""
|
| 450 |
+
if self._transform is None:
|
| 451 |
+
self._transform = IdentityTransform()
|
| 452 |
+
elif (not isinstance(self._transform, Transform)
|
| 453 |
+
and hasattr(self._transform, '_as_mpl_transform')):
|
| 454 |
+
self._transform = self._transform._as_mpl_transform(self.axes)
|
| 455 |
+
return self._transform
|
| 456 |
+
|
| 457 |
+
def get_children(self):
|
| 458 |
+
r"""Return a list of the child `.Artist`\s of this `.Artist`."""
|
| 459 |
+
return []
|
| 460 |
+
|
| 461 |
+
def _different_canvas(self, event):
|
| 462 |
+
"""
|
| 463 |
+
Check whether an *event* occurred on a canvas other that this artist's canvas.
|
| 464 |
+
|
| 465 |
+
If this method returns True, the event definitely occurred on a different
|
| 466 |
+
canvas; if it returns False, either it occurred on the same canvas, or we may
|
| 467 |
+
not have enough information to know.
|
| 468 |
+
|
| 469 |
+
Subclasses should start their definition of `contains` as follows::
|
| 470 |
+
|
| 471 |
+
if self._different_canvas(mouseevent):
|
| 472 |
+
return False, {}
|
| 473 |
+
# subclass-specific implementation follows
|
| 474 |
+
"""
|
| 475 |
+
return (getattr(event, "canvas", None) is not None
|
| 476 |
+
and (fig := self.get_figure(root=True)) is not None
|
| 477 |
+
and event.canvas is not fig.canvas)
|
| 478 |
+
|
| 479 |
+
def contains(self, mouseevent):
|
| 480 |
+
"""
|
| 481 |
+
Test whether the artist contains the mouse event.
|
| 482 |
+
|
| 483 |
+
Parameters
|
| 484 |
+
----------
|
| 485 |
+
mouseevent : `~matplotlib.backend_bases.MouseEvent`
|
| 486 |
+
|
| 487 |
+
Returns
|
| 488 |
+
-------
|
| 489 |
+
contains : bool
|
| 490 |
+
Whether any values are within the radius.
|
| 491 |
+
details : dict
|
| 492 |
+
An artist-specific dictionary of details of the event context,
|
| 493 |
+
such as which points are contained in the pick radius. See the
|
| 494 |
+
individual Artist subclasses for details.
|
| 495 |
+
"""
|
| 496 |
+
_log.warning("%r needs 'contains' method", self.__class__.__name__)
|
| 497 |
+
return False, {}
|
| 498 |
+
|
| 499 |
+
def pickable(self):
|
| 500 |
+
"""
|
| 501 |
+
Return whether the artist is pickable.
|
| 502 |
+
|
| 503 |
+
See Also
|
| 504 |
+
--------
|
| 505 |
+
.Artist.set_picker, .Artist.get_picker, .Artist.pick
|
| 506 |
+
"""
|
| 507 |
+
return self.get_figure(root=False) is not None and self._picker is not None
|
| 508 |
+
|
| 509 |
+
def pick(self, mouseevent):
|
| 510 |
+
"""
|
| 511 |
+
Process a pick event.
|
| 512 |
+
|
| 513 |
+
Each child artist will fire a pick event if *mouseevent* is over
|
| 514 |
+
the artist and the artist has picker set.
|
| 515 |
+
|
| 516 |
+
See Also
|
| 517 |
+
--------
|
| 518 |
+
.Artist.set_picker, .Artist.get_picker, .Artist.pickable
|
| 519 |
+
"""
|
| 520 |
+
from .backend_bases import PickEvent # Circular import.
|
| 521 |
+
# Pick self
|
| 522 |
+
if self.pickable():
|
| 523 |
+
picker = self.get_picker()
|
| 524 |
+
if callable(picker):
|
| 525 |
+
inside, prop = picker(self, mouseevent)
|
| 526 |
+
else:
|
| 527 |
+
inside, prop = self.contains(mouseevent)
|
| 528 |
+
if inside:
|
| 529 |
+
PickEvent("pick_event", self.get_figure(root=True).canvas,
|
| 530 |
+
mouseevent, self, **prop)._process()
|
| 531 |
+
|
| 532 |
+
# Pick children
|
| 533 |
+
for a in self.get_children():
|
| 534 |
+
# make sure the event happened in the same Axes
|
| 535 |
+
ax = getattr(a, 'axes', None)
|
| 536 |
+
if (isinstance(a, mpl.figure.SubFigure)
|
| 537 |
+
or mouseevent.inaxes is None or ax is None
|
| 538 |
+
or mouseevent.inaxes == ax):
|
| 539 |
+
# we need to check if mouseevent.inaxes is None
|
| 540 |
+
# because some objects associated with an Axes (e.g., a
|
| 541 |
+
# tick label) can be outside the bounding box of the
|
| 542 |
+
# Axes and inaxes will be None
|
| 543 |
+
# also check that ax is None so that it traverse objects
|
| 544 |
+
# which do not have an axes property but children might
|
| 545 |
+
a.pick(mouseevent)
|
| 546 |
+
|
| 547 |
+
def set_picker(self, picker):
|
| 548 |
+
"""
|
| 549 |
+
Define the picking behavior of the artist.
|
| 550 |
+
|
| 551 |
+
Parameters
|
| 552 |
+
----------
|
| 553 |
+
picker : None or bool or float or callable
|
| 554 |
+
This can be one of the following:
|
| 555 |
+
|
| 556 |
+
- *None*: Picking is disabled for this artist (default).
|
| 557 |
+
|
| 558 |
+
- A boolean: If *True* then picking will be enabled and the
|
| 559 |
+
artist will fire a pick event if the mouse event is over
|
| 560 |
+
the artist.
|
| 561 |
+
|
| 562 |
+
- A float: If picker is a number it is interpreted as an
|
| 563 |
+
epsilon tolerance in points and the artist will fire
|
| 564 |
+
off an event if its data is within epsilon of the mouse
|
| 565 |
+
event. For some artists like lines and patch collections,
|
| 566 |
+
the artist may provide additional data to the pick event
|
| 567 |
+
that is generated, e.g., the indices of the data within
|
| 568 |
+
epsilon of the pick event
|
| 569 |
+
|
| 570 |
+
- A function: If picker is callable, it is a user supplied
|
| 571 |
+
function which determines whether the artist is hit by the
|
| 572 |
+
mouse event::
|
| 573 |
+
|
| 574 |
+
hit, props = picker(artist, mouseevent)
|
| 575 |
+
|
| 576 |
+
to determine the hit test. if the mouse event is over the
|
| 577 |
+
artist, return *hit=True* and props is a dictionary of
|
| 578 |
+
properties you want added to the PickEvent attributes.
|
| 579 |
+
"""
|
| 580 |
+
self._picker = picker
|
| 581 |
+
|
| 582 |
+
def get_picker(self):
|
| 583 |
+
"""
|
| 584 |
+
Return the picking behavior of the artist.
|
| 585 |
+
|
| 586 |
+
The possible values are described in `.Artist.set_picker`.
|
| 587 |
+
|
| 588 |
+
See Also
|
| 589 |
+
--------
|
| 590 |
+
.Artist.set_picker, .Artist.pickable, .Artist.pick
|
| 591 |
+
"""
|
| 592 |
+
return self._picker
|
| 593 |
+
|
| 594 |
+
def get_url(self):
|
| 595 |
+
"""Return the url."""
|
| 596 |
+
return self._url
|
| 597 |
+
|
| 598 |
+
def set_url(self, url):
|
| 599 |
+
"""
|
| 600 |
+
Set the url for the artist.
|
| 601 |
+
|
| 602 |
+
Parameters
|
| 603 |
+
----------
|
| 604 |
+
url : str
|
| 605 |
+
"""
|
| 606 |
+
self._url = url
|
| 607 |
+
|
| 608 |
+
def get_gid(self):
|
| 609 |
+
"""Return the group id."""
|
| 610 |
+
return self._gid
|
| 611 |
+
|
| 612 |
+
def set_gid(self, gid):
|
| 613 |
+
"""
|
| 614 |
+
Set the (group) id for the artist.
|
| 615 |
+
|
| 616 |
+
Parameters
|
| 617 |
+
----------
|
| 618 |
+
gid : str
|
| 619 |
+
"""
|
| 620 |
+
self._gid = gid
|
| 621 |
+
|
| 622 |
+
def get_snap(self):
|
| 623 |
+
"""
|
| 624 |
+
Return the snap setting.
|
| 625 |
+
|
| 626 |
+
See `.set_snap` for details.
|
| 627 |
+
"""
|
| 628 |
+
if mpl.rcParams['path.snap']:
|
| 629 |
+
return self._snap
|
| 630 |
+
else:
|
| 631 |
+
return False
|
| 632 |
+
|
| 633 |
+
def set_snap(self, snap):
|
| 634 |
+
"""
|
| 635 |
+
Set the snapping behavior.
|
| 636 |
+
|
| 637 |
+
Snapping aligns positions with the pixel grid, which results in
|
| 638 |
+
clearer images. For example, if a black line of 1px width was
|
| 639 |
+
defined at a position in between two pixels, the resulting image
|
| 640 |
+
would contain the interpolated value of that line in the pixel grid,
|
| 641 |
+
which would be a grey value on both adjacent pixel positions. In
|
| 642 |
+
contrast, snapping will move the line to the nearest integer pixel
|
| 643 |
+
value, so that the resulting image will really contain a 1px wide
|
| 644 |
+
black line.
|
| 645 |
+
|
| 646 |
+
Snapping is currently only supported by the Agg and MacOSX backends.
|
| 647 |
+
|
| 648 |
+
Parameters
|
| 649 |
+
----------
|
| 650 |
+
snap : bool or None
|
| 651 |
+
Possible values:
|
| 652 |
+
|
| 653 |
+
- *True*: Snap vertices to the nearest pixel center.
|
| 654 |
+
- *False*: Do not modify vertex positions.
|
| 655 |
+
- *None*: (auto) If the path contains only rectilinear line
|
| 656 |
+
segments, round to the nearest pixel center.
|
| 657 |
+
"""
|
| 658 |
+
self._snap = snap
|
| 659 |
+
self.stale = True
|
| 660 |
+
|
| 661 |
+
def get_sketch_params(self):
|
| 662 |
+
"""
|
| 663 |
+
Return the sketch parameters for the artist.
|
| 664 |
+
|
| 665 |
+
Returns
|
| 666 |
+
-------
|
| 667 |
+
tuple or None
|
| 668 |
+
|
| 669 |
+
A 3-tuple with the following elements:
|
| 670 |
+
|
| 671 |
+
- *scale*: The amplitude of the wiggle perpendicular to the
|
| 672 |
+
source line.
|
| 673 |
+
- *length*: The length of the wiggle along the line.
|
| 674 |
+
- *randomness*: The scale factor by which the length is
|
| 675 |
+
shrunken or expanded.
|
| 676 |
+
|
| 677 |
+
Returns *None* if no sketch parameters were set.
|
| 678 |
+
"""
|
| 679 |
+
return self._sketch
|
| 680 |
+
|
| 681 |
+
def set_sketch_params(self, scale=None, length=None, randomness=None):
|
| 682 |
+
"""
|
| 683 |
+
Set the sketch parameters.
|
| 684 |
+
|
| 685 |
+
Parameters
|
| 686 |
+
----------
|
| 687 |
+
scale : float, optional
|
| 688 |
+
The amplitude of the wiggle perpendicular to the source
|
| 689 |
+
line, in pixels. If scale is `None`, or not provided, no
|
| 690 |
+
sketch filter will be provided.
|
| 691 |
+
length : float, optional
|
| 692 |
+
The length of the wiggle along the line, in pixels
|
| 693 |
+
(default 128.0)
|
| 694 |
+
randomness : float, optional
|
| 695 |
+
The scale factor by which the length is shrunken or
|
| 696 |
+
expanded (default 16.0)
|
| 697 |
+
|
| 698 |
+
The PGF backend uses this argument as an RNG seed and not as
|
| 699 |
+
described above. Using the same seed yields the same random shape.
|
| 700 |
+
|
| 701 |
+
.. ACCEPTS: (scale: float, length: float, randomness: float)
|
| 702 |
+
"""
|
| 703 |
+
if scale is None:
|
| 704 |
+
self._sketch = None
|
| 705 |
+
else:
|
| 706 |
+
self._sketch = (scale, length or 128.0, randomness or 16.0)
|
| 707 |
+
self.stale = True
|
| 708 |
+
|
| 709 |
+
def set_path_effects(self, path_effects):
|
| 710 |
+
"""
|
| 711 |
+
Set the path effects.
|
| 712 |
+
|
| 713 |
+
Parameters
|
| 714 |
+
----------
|
| 715 |
+
path_effects : list of `.AbstractPathEffect`
|
| 716 |
+
"""
|
| 717 |
+
self._path_effects = path_effects
|
| 718 |
+
self.stale = True
|
| 719 |
+
|
| 720 |
+
def get_path_effects(self):
|
| 721 |
+
return self._path_effects
|
| 722 |
+
|
| 723 |
+
def get_figure(self, root=False):
|
| 724 |
+
"""
|
| 725 |
+
Return the `.Figure` or `.SubFigure` instance the artist belongs to.
|
| 726 |
+
|
| 727 |
+
Parameters
|
| 728 |
+
----------
|
| 729 |
+
root : bool, default=False
|
| 730 |
+
If False, return the (Sub)Figure this artist is on. If True,
|
| 731 |
+
return the root Figure for a nested tree of SubFigures.
|
| 732 |
+
"""
|
| 733 |
+
if root and self._parent_figure is not None:
|
| 734 |
+
return self._parent_figure.get_figure(root=True)
|
| 735 |
+
|
| 736 |
+
return self._parent_figure
|
| 737 |
+
|
| 738 |
+
def set_figure(self, fig):
|
| 739 |
+
"""
|
| 740 |
+
Set the `.Figure` or `.SubFigure` instance the artist belongs to.
|
| 741 |
+
|
| 742 |
+
Parameters
|
| 743 |
+
----------
|
| 744 |
+
fig : `~matplotlib.figure.Figure` or `~matplotlib.figure.SubFigure`
|
| 745 |
+
"""
|
| 746 |
+
# if this is a no-op just return
|
| 747 |
+
if self._parent_figure is fig:
|
| 748 |
+
return
|
| 749 |
+
# if we currently have a figure (the case of both `self.figure`
|
| 750 |
+
# and *fig* being none is taken care of above) we then user is
|
| 751 |
+
# trying to change the figure an artist is associated with which
|
| 752 |
+
# is not allowed for the same reason as adding the same instance
|
| 753 |
+
# to more than one Axes
|
| 754 |
+
if self._parent_figure is not None:
|
| 755 |
+
raise RuntimeError("Can not put single artist in "
|
| 756 |
+
"more than one figure")
|
| 757 |
+
self._parent_figure = fig
|
| 758 |
+
if self._parent_figure and self._parent_figure is not self:
|
| 759 |
+
self.pchanged()
|
| 760 |
+
self.stale = True
|
| 761 |
+
|
| 762 |
+
figure = property(get_figure, set_figure,
|
| 763 |
+
doc=("The (Sub)Figure that the artist is on. For more "
|
| 764 |
+
"control, use the `get_figure` method."))
|
| 765 |
+
|
| 766 |
+
def set_clip_box(self, clipbox):
|
| 767 |
+
"""
|
| 768 |
+
Set the artist's clip `.Bbox`.
|
| 769 |
+
|
| 770 |
+
Parameters
|
| 771 |
+
----------
|
| 772 |
+
clipbox : `~matplotlib.transforms.BboxBase` or None
|
| 773 |
+
Will typically be created from a `.TransformedBbox`. For instance,
|
| 774 |
+
``TransformedBbox(Bbox([[0, 0], [1, 1]]), ax.transAxes)`` is the default
|
| 775 |
+
clipping for an artist added to an Axes.
|
| 776 |
+
|
| 777 |
+
"""
|
| 778 |
+
_api.check_isinstance((BboxBase, None), clipbox=clipbox)
|
| 779 |
+
if clipbox != self.clipbox:
|
| 780 |
+
self.clipbox = clipbox
|
| 781 |
+
self.pchanged()
|
| 782 |
+
self.stale = True
|
| 783 |
+
|
| 784 |
+
def set_clip_path(self, path, transform=None):
|
| 785 |
+
"""
|
| 786 |
+
Set the artist's clip path.
|
| 787 |
+
|
| 788 |
+
Parameters
|
| 789 |
+
----------
|
| 790 |
+
path : `~matplotlib.patches.Patch` or `.Path` or `.TransformedPath` or None
|
| 791 |
+
The clip path. If given a `.Path`, *transform* must be provided as
|
| 792 |
+
well. If *None*, a previously set clip path is removed.
|
| 793 |
+
transform : `~matplotlib.transforms.Transform`, optional
|
| 794 |
+
Only used if *path* is a `.Path`, in which case the given `.Path`
|
| 795 |
+
is converted to a `.TransformedPath` using *transform*.
|
| 796 |
+
|
| 797 |
+
Notes
|
| 798 |
+
-----
|
| 799 |
+
For efficiency, if *path* is a `.Rectangle` this method will set the
|
| 800 |
+
clipping box to the corresponding rectangle and set the clipping path
|
| 801 |
+
to ``None``.
|
| 802 |
+
|
| 803 |
+
For technical reasons (support of `~.Artist.set`), a tuple
|
| 804 |
+
(*path*, *transform*) is also accepted as a single positional
|
| 805 |
+
parameter.
|
| 806 |
+
|
| 807 |
+
.. ACCEPTS: Patch or (Path, Transform) or None
|
| 808 |
+
"""
|
| 809 |
+
from matplotlib.patches import Patch, Rectangle
|
| 810 |
+
|
| 811 |
+
success = False
|
| 812 |
+
if transform is None:
|
| 813 |
+
if isinstance(path, Rectangle):
|
| 814 |
+
self.clipbox = TransformedBbox(Bbox.unit(),
|
| 815 |
+
path.get_transform())
|
| 816 |
+
self._clippath = None
|
| 817 |
+
success = True
|
| 818 |
+
elif isinstance(path, Patch):
|
| 819 |
+
self._clippath = TransformedPatchPath(path)
|
| 820 |
+
success = True
|
| 821 |
+
elif isinstance(path, tuple):
|
| 822 |
+
path, transform = path
|
| 823 |
+
|
| 824 |
+
if path is None:
|
| 825 |
+
self._clippath = None
|
| 826 |
+
success = True
|
| 827 |
+
elif isinstance(path, Path):
|
| 828 |
+
self._clippath = TransformedPath(path, transform)
|
| 829 |
+
success = True
|
| 830 |
+
elif isinstance(path, TransformedPatchPath):
|
| 831 |
+
self._clippath = path
|
| 832 |
+
success = True
|
| 833 |
+
elif isinstance(path, TransformedPath):
|
| 834 |
+
self._clippath = path
|
| 835 |
+
success = True
|
| 836 |
+
|
| 837 |
+
if not success:
|
| 838 |
+
raise TypeError(
|
| 839 |
+
"Invalid arguments to set_clip_path, of type "
|
| 840 |
+
f"{type(path).__name__} and {type(transform).__name__}")
|
| 841 |
+
# This may result in the callbacks being hit twice, but guarantees they
|
| 842 |
+
# will be hit at least once.
|
| 843 |
+
self.pchanged()
|
| 844 |
+
self.stale = True
|
| 845 |
+
|
| 846 |
+
def get_alpha(self):
|
| 847 |
+
"""
|
| 848 |
+
Return the alpha value used for blending - not supported on all
|
| 849 |
+
backends.
|
| 850 |
+
"""
|
| 851 |
+
return self._alpha
|
| 852 |
+
|
| 853 |
+
def get_visible(self):
|
| 854 |
+
"""Return the visibility."""
|
| 855 |
+
return self._visible
|
| 856 |
+
|
| 857 |
+
def get_animated(self):
|
| 858 |
+
"""Return whether the artist is animated."""
|
| 859 |
+
return self._animated
|
| 860 |
+
|
| 861 |
+
def get_in_layout(self):
|
| 862 |
+
"""
|
| 863 |
+
Return boolean flag, ``True`` if artist is included in layout
|
| 864 |
+
calculations.
|
| 865 |
+
|
| 866 |
+
E.g. :ref:`constrainedlayout_guide`,
|
| 867 |
+
`.Figure.tight_layout()`, and
|
| 868 |
+
``fig.savefig(fname, bbox_inches='tight')``.
|
| 869 |
+
"""
|
| 870 |
+
return self._in_layout
|
| 871 |
+
|
| 872 |
+
def _fully_clipped_to_axes(self):
|
| 873 |
+
"""
|
| 874 |
+
Return a boolean flag, ``True`` if the artist is clipped to the Axes
|
| 875 |
+
and can thus be skipped in layout calculations. Requires `get_clip_on`
|
| 876 |
+
is True, one of `clip_box` or `clip_path` is set, ``clip_box.extents``
|
| 877 |
+
is equivalent to ``ax.bbox.extents`` (if set), and ``clip_path._patch``
|
| 878 |
+
is equivalent to ``ax.patch`` (if set).
|
| 879 |
+
"""
|
| 880 |
+
# Note that ``clip_path.get_fully_transformed_path().get_extents()``
|
| 881 |
+
# cannot be directly compared to ``axes.bbox.extents`` because the
|
| 882 |
+
# extents may be undefined (i.e. equivalent to ``Bbox.null()``)
|
| 883 |
+
# before the associated artist is drawn, and this method is meant
|
| 884 |
+
# to determine whether ``axes.get_tightbbox()`` may bypass drawing
|
| 885 |
+
clip_box = self.get_clip_box()
|
| 886 |
+
clip_path = self.get_clip_path()
|
| 887 |
+
return (self.axes is not None
|
| 888 |
+
and self.get_clip_on()
|
| 889 |
+
and (clip_box is not None or clip_path is not None)
|
| 890 |
+
and (clip_box is None
|
| 891 |
+
or np.all(clip_box.extents == self.axes.bbox.extents))
|
| 892 |
+
and (clip_path is None
|
| 893 |
+
or isinstance(clip_path, TransformedPatchPath)
|
| 894 |
+
and clip_path._patch is self.axes.patch))
|
| 895 |
+
|
| 896 |
+
def get_clip_on(self):
|
| 897 |
+
"""Return whether the artist uses clipping."""
|
| 898 |
+
return self._clipon
|
| 899 |
+
|
| 900 |
+
def get_clip_box(self):
|
| 901 |
+
"""Return the clipbox."""
|
| 902 |
+
return self.clipbox
|
| 903 |
+
|
| 904 |
+
def get_clip_path(self):
|
| 905 |
+
"""Return the clip path."""
|
| 906 |
+
return self._clippath
|
| 907 |
+
|
| 908 |
+
def get_transformed_clip_path_and_affine(self):
|
| 909 |
+
"""
|
| 910 |
+
Return the clip path with the non-affine part of its
|
| 911 |
+
transformation applied, and the remaining affine part of its
|
| 912 |
+
transformation.
|
| 913 |
+
"""
|
| 914 |
+
if self._clippath is not None:
|
| 915 |
+
return self._clippath.get_transformed_path_and_affine()
|
| 916 |
+
return None, None
|
| 917 |
+
|
| 918 |
+
def set_clip_on(self, b):
|
| 919 |
+
"""
|
| 920 |
+
Set whether the artist uses clipping.
|
| 921 |
+
|
| 922 |
+
When False, artists will be visible outside the Axes which
|
| 923 |
+
can lead to unexpected results.
|
| 924 |
+
|
| 925 |
+
Parameters
|
| 926 |
+
----------
|
| 927 |
+
b : bool
|
| 928 |
+
"""
|
| 929 |
+
self._clipon = b
|
| 930 |
+
# This may result in the callbacks being hit twice, but ensures they
|
| 931 |
+
# are hit at least once
|
| 932 |
+
self.pchanged()
|
| 933 |
+
self.stale = True
|
| 934 |
+
|
| 935 |
+
def _set_gc_clip(self, gc):
|
| 936 |
+
"""Set the clip properly for the gc."""
|
| 937 |
+
if self._clipon:
|
| 938 |
+
if self.clipbox is not None:
|
| 939 |
+
gc.set_clip_rectangle(self.clipbox)
|
| 940 |
+
gc.set_clip_path(self._clippath)
|
| 941 |
+
else:
|
| 942 |
+
gc.set_clip_rectangle(None)
|
| 943 |
+
gc.set_clip_path(None)
|
| 944 |
+
|
| 945 |
+
def get_rasterized(self):
|
| 946 |
+
"""Return whether the artist is to be rasterized."""
|
| 947 |
+
return self._rasterized
|
| 948 |
+
|
| 949 |
+
def set_rasterized(self, rasterized):
|
| 950 |
+
"""
|
| 951 |
+
Force rasterized (bitmap) drawing for vector graphics output.
|
| 952 |
+
|
| 953 |
+
Rasterized drawing is not supported by all artists. If you try to
|
| 954 |
+
enable this on an artist that does not support it, the command has no
|
| 955 |
+
effect and a warning will be issued.
|
| 956 |
+
|
| 957 |
+
This setting is ignored for pixel-based output.
|
| 958 |
+
|
| 959 |
+
See also :doc:`/gallery/misc/rasterization_demo`.
|
| 960 |
+
|
| 961 |
+
Parameters
|
| 962 |
+
----------
|
| 963 |
+
rasterized : bool
|
| 964 |
+
"""
|
| 965 |
+
supports_rasterization = getattr(self.draw,
|
| 966 |
+
"_supports_rasterization", False)
|
| 967 |
+
if rasterized and not supports_rasterization:
|
| 968 |
+
_api.warn_external(f"Rasterization of '{self}' will be ignored")
|
| 969 |
+
|
| 970 |
+
self._rasterized = rasterized
|
| 971 |
+
|
| 972 |
+
def get_agg_filter(self):
|
| 973 |
+
"""Return filter function to be used for agg filter."""
|
| 974 |
+
return self._agg_filter
|
| 975 |
+
|
| 976 |
+
def set_agg_filter(self, filter_func):
|
| 977 |
+
"""
|
| 978 |
+
Set the agg filter.
|
| 979 |
+
|
| 980 |
+
Parameters
|
| 981 |
+
----------
|
| 982 |
+
filter_func : callable
|
| 983 |
+
A filter function, which takes a (m, n, depth) float array
|
| 984 |
+
and a dpi value, and returns a (m, n, depth) array and two
|
| 985 |
+
offsets from the bottom left corner of the image
|
| 986 |
+
|
| 987 |
+
.. ACCEPTS: a filter function, which takes a (m, n, 3) float array
|
| 988 |
+
and a dpi value, and returns a (m, n, 3) array and two offsets
|
| 989 |
+
from the bottom left corner of the image
|
| 990 |
+
"""
|
| 991 |
+
self._agg_filter = filter_func
|
| 992 |
+
self.stale = True
|
| 993 |
+
|
| 994 |
+
def draw(self, renderer):
|
| 995 |
+
"""
|
| 996 |
+
Draw the Artist (and its children) using the given renderer.
|
| 997 |
+
|
| 998 |
+
This has no effect if the artist is not visible (`.Artist.get_visible`
|
| 999 |
+
returns False).
|
| 1000 |
+
|
| 1001 |
+
Parameters
|
| 1002 |
+
----------
|
| 1003 |
+
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
|
| 1004 |
+
|
| 1005 |
+
Notes
|
| 1006 |
+
-----
|
| 1007 |
+
This method is overridden in the Artist subclasses.
|
| 1008 |
+
"""
|
| 1009 |
+
if not self.get_visible():
|
| 1010 |
+
return
|
| 1011 |
+
self.stale = False
|
| 1012 |
+
|
| 1013 |
+
def set_alpha(self, alpha):
|
| 1014 |
+
"""
|
| 1015 |
+
Set the alpha value used for blending - not supported on all backends.
|
| 1016 |
+
|
| 1017 |
+
Parameters
|
| 1018 |
+
----------
|
| 1019 |
+
alpha : float or None
|
| 1020 |
+
*alpha* must be within the 0-1 range, inclusive.
|
| 1021 |
+
"""
|
| 1022 |
+
if alpha is not None and not isinstance(alpha, Real):
|
| 1023 |
+
raise TypeError(
|
| 1024 |
+
f'alpha must be numeric or None, not {type(alpha)}')
|
| 1025 |
+
if alpha is not None and not (0 <= alpha <= 1):
|
| 1026 |
+
raise ValueError(f'alpha ({alpha}) is outside 0-1 range')
|
| 1027 |
+
if alpha != self._alpha:
|
| 1028 |
+
self._alpha = alpha
|
| 1029 |
+
self.pchanged()
|
| 1030 |
+
self.stale = True
|
| 1031 |
+
|
| 1032 |
+
def _set_alpha_for_array(self, alpha):
|
| 1033 |
+
"""
|
| 1034 |
+
Set the alpha value used for blending - not supported on all backends.
|
| 1035 |
+
|
| 1036 |
+
Parameters
|
| 1037 |
+
----------
|
| 1038 |
+
alpha : array-like or float or None
|
| 1039 |
+
All values must be within the 0-1 range, inclusive.
|
| 1040 |
+
Masked values and nans are not supported.
|
| 1041 |
+
"""
|
| 1042 |
+
if isinstance(alpha, str):
|
| 1043 |
+
raise TypeError("alpha must be numeric or None, not a string")
|
| 1044 |
+
if not np.iterable(alpha):
|
| 1045 |
+
Artist.set_alpha(self, alpha)
|
| 1046 |
+
return
|
| 1047 |
+
alpha = np.asarray(alpha)
|
| 1048 |
+
if not (0 <= alpha.min() and alpha.max() <= 1):
|
| 1049 |
+
raise ValueError('alpha must be between 0 and 1, inclusive, '
|
| 1050 |
+
f'but min is {alpha.min()}, max is {alpha.max()}')
|
| 1051 |
+
self._alpha = alpha
|
| 1052 |
+
self.pchanged()
|
| 1053 |
+
self.stale = True
|
| 1054 |
+
|
| 1055 |
+
def set_visible(self, b):
|
| 1056 |
+
"""
|
| 1057 |
+
Set the artist's visibility.
|
| 1058 |
+
|
| 1059 |
+
Parameters
|
| 1060 |
+
----------
|
| 1061 |
+
b : bool
|
| 1062 |
+
"""
|
| 1063 |
+
if b != self._visible:
|
| 1064 |
+
self._visible = b
|
| 1065 |
+
self.pchanged()
|
| 1066 |
+
self.stale = True
|
| 1067 |
+
|
| 1068 |
+
def set_animated(self, b):
|
| 1069 |
+
"""
|
| 1070 |
+
Set whether the artist is intended to be used in an animation.
|
| 1071 |
+
|
| 1072 |
+
If True, the artist is excluded from regular drawing of the figure.
|
| 1073 |
+
You have to call `.Figure.draw_artist` / `.Axes.draw_artist`
|
| 1074 |
+
explicitly on the artist. This approach is used to speed up animations
|
| 1075 |
+
using blitting.
|
| 1076 |
+
|
| 1077 |
+
See also `matplotlib.animation` and
|
| 1078 |
+
:ref:`blitting`.
|
| 1079 |
+
|
| 1080 |
+
Parameters
|
| 1081 |
+
----------
|
| 1082 |
+
b : bool
|
| 1083 |
+
"""
|
| 1084 |
+
if self._animated != b:
|
| 1085 |
+
self._animated = b
|
| 1086 |
+
self.pchanged()
|
| 1087 |
+
|
| 1088 |
+
def set_in_layout(self, in_layout):
|
| 1089 |
+
"""
|
| 1090 |
+
Set if artist is to be included in layout calculations,
|
| 1091 |
+
E.g. :ref:`constrainedlayout_guide`,
|
| 1092 |
+
`.Figure.tight_layout()`, and
|
| 1093 |
+
``fig.savefig(fname, bbox_inches='tight')``.
|
| 1094 |
+
|
| 1095 |
+
Parameters
|
| 1096 |
+
----------
|
| 1097 |
+
in_layout : bool
|
| 1098 |
+
"""
|
| 1099 |
+
self._in_layout = in_layout
|
| 1100 |
+
|
| 1101 |
+
def get_label(self):
|
| 1102 |
+
"""Return the label used for this artist in the legend."""
|
| 1103 |
+
return self._label
|
| 1104 |
+
|
| 1105 |
+
def set_label(self, s):
|
| 1106 |
+
"""
|
| 1107 |
+
Set a label that will be displayed in the legend.
|
| 1108 |
+
|
| 1109 |
+
Parameters
|
| 1110 |
+
----------
|
| 1111 |
+
s : object
|
| 1112 |
+
*s* will be converted to a string by calling `str`.
|
| 1113 |
+
"""
|
| 1114 |
+
label = str(s) if s is not None else None
|
| 1115 |
+
if label != self._label:
|
| 1116 |
+
self._label = label
|
| 1117 |
+
self.pchanged()
|
| 1118 |
+
self.stale = True
|
| 1119 |
+
|
| 1120 |
+
def get_zorder(self):
|
| 1121 |
+
"""Return the artist's zorder."""
|
| 1122 |
+
return self.zorder
|
| 1123 |
+
|
| 1124 |
+
def set_zorder(self, level):
|
| 1125 |
+
"""
|
| 1126 |
+
Set the zorder for the artist. Artists with lower zorder
|
| 1127 |
+
values are drawn first.
|
| 1128 |
+
|
| 1129 |
+
Parameters
|
| 1130 |
+
----------
|
| 1131 |
+
level : float
|
| 1132 |
+
"""
|
| 1133 |
+
if level is None:
|
| 1134 |
+
level = self.__class__.zorder
|
| 1135 |
+
if level != self.zorder:
|
| 1136 |
+
self.zorder = level
|
| 1137 |
+
self.pchanged()
|
| 1138 |
+
self.stale = True
|
| 1139 |
+
|
| 1140 |
+
@property
|
| 1141 |
+
def sticky_edges(self):
|
| 1142 |
+
"""
|
| 1143 |
+
``x`` and ``y`` sticky edge lists for autoscaling.
|
| 1144 |
+
|
| 1145 |
+
When performing autoscaling, if a data limit coincides with a value in
|
| 1146 |
+
the corresponding sticky_edges list, then no margin will be added--the
|
| 1147 |
+
view limit "sticks" to the edge. A typical use case is histograms,
|
| 1148 |
+
where one usually expects no margin on the bottom edge (0) of the
|
| 1149 |
+
histogram.
|
| 1150 |
+
|
| 1151 |
+
Moreover, margin expansion "bumps" against sticky edges and cannot
|
| 1152 |
+
cross them. For example, if the upper data limit is 1.0, the upper
|
| 1153 |
+
view limit computed by simple margin application is 1.2, but there is a
|
| 1154 |
+
sticky edge at 1.1, then the actual upper view limit will be 1.1.
|
| 1155 |
+
|
| 1156 |
+
This attribute cannot be assigned to; however, the ``x`` and ``y``
|
| 1157 |
+
lists can be modified in place as needed.
|
| 1158 |
+
|
| 1159 |
+
Examples
|
| 1160 |
+
--------
|
| 1161 |
+
>>> artist.sticky_edges.x[:] = (xmin, xmax)
|
| 1162 |
+
>>> artist.sticky_edges.y[:] = (ymin, ymax)
|
| 1163 |
+
|
| 1164 |
+
"""
|
| 1165 |
+
return self._sticky_edges
|
| 1166 |
+
|
| 1167 |
+
def update_from(self, other):
|
| 1168 |
+
"""Copy properties from *other* to *self*."""
|
| 1169 |
+
self._transform = other._transform
|
| 1170 |
+
self._transformSet = other._transformSet
|
| 1171 |
+
self._visible = other._visible
|
| 1172 |
+
self._alpha = other._alpha
|
| 1173 |
+
self.clipbox = other.clipbox
|
| 1174 |
+
self._clipon = other._clipon
|
| 1175 |
+
self._clippath = other._clippath
|
| 1176 |
+
self._label = other._label
|
| 1177 |
+
self._sketch = other._sketch
|
| 1178 |
+
self._path_effects = other._path_effects
|
| 1179 |
+
self.sticky_edges.x[:] = other.sticky_edges.x.copy()
|
| 1180 |
+
self.sticky_edges.y[:] = other.sticky_edges.y.copy()
|
| 1181 |
+
self.pchanged()
|
| 1182 |
+
self.stale = True
|
| 1183 |
+
|
| 1184 |
+
def properties(self):
|
| 1185 |
+
"""Return a dictionary of all the properties of the artist."""
|
| 1186 |
+
return ArtistInspector(self).properties()
|
| 1187 |
+
|
| 1188 |
+
def _update_props(self, props, errfmt):
|
| 1189 |
+
"""
|
| 1190 |
+
Helper for `.Artist.set` and `.Artist.update`.
|
| 1191 |
+
|
| 1192 |
+
*errfmt* is used to generate error messages for invalid property
|
| 1193 |
+
names; it gets formatted with ``type(self)`` for "{cls}" and the
|
| 1194 |
+
property name for "{prop_name}".
|
| 1195 |
+
"""
|
| 1196 |
+
ret = []
|
| 1197 |
+
with cbook._setattr_cm(self, eventson=False):
|
| 1198 |
+
for k, v in props.items():
|
| 1199 |
+
# Allow attributes we want to be able to update through
|
| 1200 |
+
# art.update, art.set, setp.
|
| 1201 |
+
if k == "axes":
|
| 1202 |
+
ret.append(setattr(self, k, v))
|
| 1203 |
+
else:
|
| 1204 |
+
func = getattr(self, f"set_{k}", None)
|
| 1205 |
+
if not callable(func):
|
| 1206 |
+
raise AttributeError(
|
| 1207 |
+
errfmt.format(cls=type(self), prop_name=k),
|
| 1208 |
+
name=k)
|
| 1209 |
+
ret.append(func(v))
|
| 1210 |
+
if ret:
|
| 1211 |
+
self.pchanged()
|
| 1212 |
+
self.stale = True
|
| 1213 |
+
return ret
|
| 1214 |
+
|
| 1215 |
+
def update(self, props):
|
| 1216 |
+
"""
|
| 1217 |
+
Update this artist's properties from the dict *props*.
|
| 1218 |
+
|
| 1219 |
+
Parameters
|
| 1220 |
+
----------
|
| 1221 |
+
props : dict
|
| 1222 |
+
"""
|
| 1223 |
+
return self._update_props(
|
| 1224 |
+
props, "{cls.__name__!r} object has no property {prop_name!r}")
|
| 1225 |
+
|
| 1226 |
+
def _internal_update(self, kwargs):
|
| 1227 |
+
"""
|
| 1228 |
+
Update artist properties without prenormalizing them, but generating
|
| 1229 |
+
errors as if calling `set`.
|
| 1230 |
+
|
| 1231 |
+
The lack of prenormalization is to maintain backcompatibility.
|
| 1232 |
+
"""
|
| 1233 |
+
return self._update_props(
|
| 1234 |
+
kwargs, "{cls.__name__}.set() got an unexpected keyword argument "
|
| 1235 |
+
"{prop_name!r}")
|
| 1236 |
+
|
| 1237 |
+
def set(self, **kwargs):
|
| 1238 |
+
# docstring and signature are auto-generated via
|
| 1239 |
+
# Artist._update_set_signature_and_docstring() at the end of the
|
| 1240 |
+
# module.
|
| 1241 |
+
return self._internal_update(cbook.normalize_kwargs(kwargs, self))
|
| 1242 |
+
|
| 1243 |
+
@contextlib.contextmanager
|
| 1244 |
+
def _cm_set(self, **kwargs):
|
| 1245 |
+
"""
|
| 1246 |
+
`.Artist.set` context-manager that restores original values at exit.
|
| 1247 |
+
"""
|
| 1248 |
+
orig_vals = {k: getattr(self, f"get_{k}")() for k in kwargs}
|
| 1249 |
+
try:
|
| 1250 |
+
self.set(**kwargs)
|
| 1251 |
+
yield
|
| 1252 |
+
finally:
|
| 1253 |
+
self.set(**orig_vals)
|
| 1254 |
+
|
| 1255 |
+
def findobj(self, match=None, include_self=True):
|
| 1256 |
+
"""
|
| 1257 |
+
Find artist objects.
|
| 1258 |
+
|
| 1259 |
+
Recursively find all `.Artist` instances contained in the artist.
|
| 1260 |
+
|
| 1261 |
+
Parameters
|
| 1262 |
+
----------
|
| 1263 |
+
match
|
| 1264 |
+
A filter criterion for the matches. This can be
|
| 1265 |
+
|
| 1266 |
+
- *None*: Return all objects contained in artist.
|
| 1267 |
+
- A function with signature ``def match(artist: Artist) -> bool``.
|
| 1268 |
+
The result will only contain artists for which the function
|
| 1269 |
+
returns *True*.
|
| 1270 |
+
- A class instance: e.g., `.Line2D`. The result will only contain
|
| 1271 |
+
artists of this class or its subclasses (``isinstance`` check).
|
| 1272 |
+
|
| 1273 |
+
include_self : bool
|
| 1274 |
+
Include *self* in the list to be checked for a match.
|
| 1275 |
+
|
| 1276 |
+
Returns
|
| 1277 |
+
-------
|
| 1278 |
+
list of `.Artist`
|
| 1279 |
+
|
| 1280 |
+
"""
|
| 1281 |
+
if match is None: # always return True
|
| 1282 |
+
def matchfunc(x):
|
| 1283 |
+
return True
|
| 1284 |
+
elif isinstance(match, type) and issubclass(match, Artist):
|
| 1285 |
+
def matchfunc(x):
|
| 1286 |
+
return isinstance(x, match)
|
| 1287 |
+
elif callable(match):
|
| 1288 |
+
matchfunc = match
|
| 1289 |
+
else:
|
| 1290 |
+
raise ValueError('match must be None, a matplotlib.artist.Artist '
|
| 1291 |
+
'subclass, or a callable')
|
| 1292 |
+
|
| 1293 |
+
artists = reduce(operator.iadd,
|
| 1294 |
+
[c.findobj(matchfunc) for c in self.get_children()], [])
|
| 1295 |
+
if include_self and matchfunc(self):
|
| 1296 |
+
artists.append(self)
|
| 1297 |
+
return artists
|
| 1298 |
+
|
| 1299 |
+
def get_cursor_data(self, event):
|
| 1300 |
+
"""
|
| 1301 |
+
Return the cursor data for a given event.
|
| 1302 |
+
|
| 1303 |
+
.. note::
|
| 1304 |
+
This method is intended to be overridden by artist subclasses.
|
| 1305 |
+
As an end-user of Matplotlib you will most likely not call this
|
| 1306 |
+
method yourself.
|
| 1307 |
+
|
| 1308 |
+
Cursor data can be used by Artists to provide additional context
|
| 1309 |
+
information for a given event. The default implementation just returns
|
| 1310 |
+
*None*.
|
| 1311 |
+
|
| 1312 |
+
Subclasses can override the method and return arbitrary data. However,
|
| 1313 |
+
when doing so, they must ensure that `.format_cursor_data` can convert
|
| 1314 |
+
the data to a string representation.
|
| 1315 |
+
|
| 1316 |
+
The only current use case is displaying the z-value of an `.AxesImage`
|
| 1317 |
+
in the status bar of a plot window, while moving the mouse.
|
| 1318 |
+
|
| 1319 |
+
Parameters
|
| 1320 |
+
----------
|
| 1321 |
+
event : `~matplotlib.backend_bases.MouseEvent`
|
| 1322 |
+
|
| 1323 |
+
See Also
|
| 1324 |
+
--------
|
| 1325 |
+
format_cursor_data
|
| 1326 |
+
|
| 1327 |
+
"""
|
| 1328 |
+
return None
|
| 1329 |
+
|
| 1330 |
+
def format_cursor_data(self, data):
|
| 1331 |
+
"""
|
| 1332 |
+
Return a string representation of *data*.
|
| 1333 |
+
|
| 1334 |
+
.. note::
|
| 1335 |
+
This method is intended to be overridden by artist subclasses.
|
| 1336 |
+
As an end-user of Matplotlib you will most likely not call this
|
| 1337 |
+
method yourself.
|
| 1338 |
+
|
| 1339 |
+
The default implementation converts ints and floats and arrays of ints
|
| 1340 |
+
and floats into a comma-separated string enclosed in square brackets,
|
| 1341 |
+
unless the artist has an associated colorbar, in which case scalar
|
| 1342 |
+
values are formatted using the colorbar's formatter.
|
| 1343 |
+
|
| 1344 |
+
See Also
|
| 1345 |
+
--------
|
| 1346 |
+
get_cursor_data
|
| 1347 |
+
"""
|
| 1348 |
+
if np.ndim(data) == 0 and hasattr(self, "_format_cursor_data_override"):
|
| 1349 |
+
# workaround for ScalarMappable to be able to define its own
|
| 1350 |
+
# format_cursor_data(). See ScalarMappable._format_cursor_data_override
|
| 1351 |
+
# for details.
|
| 1352 |
+
return self._format_cursor_data_override(data)
|
| 1353 |
+
else:
|
| 1354 |
+
try:
|
| 1355 |
+
data[0]
|
| 1356 |
+
except (TypeError, IndexError):
|
| 1357 |
+
data = [data]
|
| 1358 |
+
data_str = ', '.join(f'{item:0.3g}' for item in data
|
| 1359 |
+
if isinstance(item, Number))
|
| 1360 |
+
return "[" + data_str + "]"
|
| 1361 |
+
|
| 1362 |
+
def get_mouseover(self):
|
| 1363 |
+
"""
|
| 1364 |
+
Return whether this artist is queried for custom context information
|
| 1365 |
+
when the mouse cursor moves over it.
|
| 1366 |
+
"""
|
| 1367 |
+
return self._mouseover
|
| 1368 |
+
|
| 1369 |
+
def set_mouseover(self, mouseover):
|
| 1370 |
+
"""
|
| 1371 |
+
Set whether this artist is queried for custom context information when
|
| 1372 |
+
the mouse cursor moves over it.
|
| 1373 |
+
|
| 1374 |
+
Parameters
|
| 1375 |
+
----------
|
| 1376 |
+
mouseover : bool
|
| 1377 |
+
|
| 1378 |
+
See Also
|
| 1379 |
+
--------
|
| 1380 |
+
get_cursor_data
|
| 1381 |
+
.ToolCursorPosition
|
| 1382 |
+
.NavigationToolbar2
|
| 1383 |
+
"""
|
| 1384 |
+
self._mouseover = bool(mouseover)
|
| 1385 |
+
ax = self.axes
|
| 1386 |
+
if ax:
|
| 1387 |
+
if self._mouseover:
|
| 1388 |
+
ax._mouseover_set.add(self)
|
| 1389 |
+
else:
|
| 1390 |
+
ax._mouseover_set.discard(self)
|
| 1391 |
+
|
| 1392 |
+
mouseover = property(get_mouseover, set_mouseover) # backcompat.
|
| 1393 |
+
|
| 1394 |
+
|
| 1395 |
+
def _get_tightbbox_for_layout_only(obj, *args, **kwargs):
|
| 1396 |
+
"""
|
| 1397 |
+
Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a
|
| 1398 |
+
*for_layout_only* kwarg; this helper tries to use the kwarg but skips it
|
| 1399 |
+
when encountering third-party subclasses that do not support it.
|
| 1400 |
+
"""
|
| 1401 |
+
try:
|
| 1402 |
+
return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True})
|
| 1403 |
+
except TypeError:
|
| 1404 |
+
return obj.get_tightbbox(*args, **kwargs)
|
| 1405 |
+
|
| 1406 |
+
|
| 1407 |
+
class ArtistInspector:
|
| 1408 |
+
"""
|
| 1409 |
+
A helper class to inspect an `~matplotlib.artist.Artist` and return
|
| 1410 |
+
information about its settable properties and their current values.
|
| 1411 |
+
"""
|
| 1412 |
+
|
| 1413 |
+
def __init__(self, o):
|
| 1414 |
+
r"""
|
| 1415 |
+
Initialize the artist inspector with an `Artist` or an iterable of
|
| 1416 |
+
`Artist`\s. If an iterable is used, we assume it is a homogeneous
|
| 1417 |
+
sequence (all `Artist`\s are of the same type) and it is your
|
| 1418 |
+
responsibility to make sure this is so.
|
| 1419 |
+
"""
|
| 1420 |
+
if not isinstance(o, Artist):
|
| 1421 |
+
if np.iterable(o):
|
| 1422 |
+
o = list(o)
|
| 1423 |
+
if len(o):
|
| 1424 |
+
o = o[0]
|
| 1425 |
+
|
| 1426 |
+
self.oorig = o
|
| 1427 |
+
if not isinstance(o, type):
|
| 1428 |
+
o = type(o)
|
| 1429 |
+
self.o = o
|
| 1430 |
+
|
| 1431 |
+
self.aliasd = self.get_aliases()
|
| 1432 |
+
|
| 1433 |
+
def get_aliases(self):
|
| 1434 |
+
"""
|
| 1435 |
+
Get a dict mapping property fullnames to sets of aliases for each alias
|
| 1436 |
+
in the :class:`~matplotlib.artist.ArtistInspector`.
|
| 1437 |
+
|
| 1438 |
+
e.g., for lines::
|
| 1439 |
+
|
| 1440 |
+
{'markerfacecolor': {'mfc'},
|
| 1441 |
+
'linewidth' : {'lw'},
|
| 1442 |
+
}
|
| 1443 |
+
"""
|
| 1444 |
+
names = [name for name in dir(self.o)
|
| 1445 |
+
if name.startswith(('set_', 'get_'))
|
| 1446 |
+
and callable(getattr(self.o, name))]
|
| 1447 |
+
aliases = {}
|
| 1448 |
+
for name in names:
|
| 1449 |
+
func = getattr(self.o, name)
|
| 1450 |
+
if not self.is_alias(func):
|
| 1451 |
+
continue
|
| 1452 |
+
propname = re.search(f"`({name[:4]}.*)`", # get_.*/set_.*
|
| 1453 |
+
inspect.getdoc(func)).group(1)
|
| 1454 |
+
aliases.setdefault(propname[4:], set()).add(name[4:])
|
| 1455 |
+
return aliases
|
| 1456 |
+
|
| 1457 |
+
_get_valid_values_regex = re.compile(
|
| 1458 |
+
r"\n\s*(?:\.\.\s+)?ACCEPTS:\s*((?:.|\n)*?)(?:$|(?:\n\n))"
|
| 1459 |
+
)
|
| 1460 |
+
|
| 1461 |
+
def get_valid_values(self, attr):
|
| 1462 |
+
"""
|
| 1463 |
+
Get the legal arguments for the setter associated with *attr*.
|
| 1464 |
+
|
| 1465 |
+
This is done by querying the docstring of the setter for a line that
|
| 1466 |
+
begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a
|
| 1467 |
+
numpydoc-style documentation for the setter's first argument.
|
| 1468 |
+
"""
|
| 1469 |
+
|
| 1470 |
+
name = 'set_%s' % attr
|
| 1471 |
+
if not hasattr(self.o, name):
|
| 1472 |
+
raise AttributeError(f'{self.o} has no function {name}')
|
| 1473 |
+
func = getattr(self.o, name)
|
| 1474 |
+
|
| 1475 |
+
if hasattr(func, '_kwarg_doc'):
|
| 1476 |
+
return func._kwarg_doc
|
| 1477 |
+
|
| 1478 |
+
docstring = inspect.getdoc(func)
|
| 1479 |
+
if docstring is None:
|
| 1480 |
+
return 'unknown'
|
| 1481 |
+
|
| 1482 |
+
if docstring.startswith('Alias for '):
|
| 1483 |
+
return None
|
| 1484 |
+
|
| 1485 |
+
match = self._get_valid_values_regex.search(docstring)
|
| 1486 |
+
if match is not None:
|
| 1487 |
+
return re.sub("\n *", " ", match.group(1))
|
| 1488 |
+
|
| 1489 |
+
# Much faster than list(inspect.signature(func).parameters)[1],
|
| 1490 |
+
# although barely relevant wrt. matplotlib's total import time.
|
| 1491 |
+
param_name = func.__code__.co_varnames[1]
|
| 1492 |
+
# We could set the presence * based on whether the parameter is a
|
| 1493 |
+
# varargs (it can't be a varkwargs) but it's not really worth it.
|
| 1494 |
+
match = re.search(fr"(?m)^ *\*?{param_name} : (.+)", docstring)
|
| 1495 |
+
if match:
|
| 1496 |
+
return match.group(1)
|
| 1497 |
+
|
| 1498 |
+
return 'unknown'
|
| 1499 |
+
|
| 1500 |
+
def _replace_path(self, source_class):
|
| 1501 |
+
"""
|
| 1502 |
+
Changes the full path to the public API path that is used
|
| 1503 |
+
in sphinx. This is needed for links to work.
|
| 1504 |
+
"""
|
| 1505 |
+
replace_dict = {'_base._AxesBase': 'Axes',
|
| 1506 |
+
'_axes.Axes': 'Axes'}
|
| 1507 |
+
for key, value in replace_dict.items():
|
| 1508 |
+
source_class = source_class.replace(key, value)
|
| 1509 |
+
return source_class
|
| 1510 |
+
|
| 1511 |
+
def get_setters(self):
|
| 1512 |
+
"""
|
| 1513 |
+
Get the attribute strings with setters for object.
|
| 1514 |
+
|
| 1515 |
+
For example, for a line, return ``['markerfacecolor', 'linewidth',
|
| 1516 |
+
....]``.
|
| 1517 |
+
"""
|
| 1518 |
+
setters = []
|
| 1519 |
+
for name in dir(self.o):
|
| 1520 |
+
if not name.startswith('set_'):
|
| 1521 |
+
continue
|
| 1522 |
+
func = getattr(self.o, name)
|
| 1523 |
+
if (not callable(func)
|
| 1524 |
+
or self.number_of_parameters(func) < 2
|
| 1525 |
+
or self.is_alias(func)):
|
| 1526 |
+
continue
|
| 1527 |
+
setters.append(name[4:])
|
| 1528 |
+
return setters
|
| 1529 |
+
|
| 1530 |
+
@staticmethod
|
| 1531 |
+
@cache
|
| 1532 |
+
def number_of_parameters(func):
|
| 1533 |
+
"""Return number of parameters of the callable *func*."""
|
| 1534 |
+
return len(inspect.signature(func).parameters)
|
| 1535 |
+
|
| 1536 |
+
@staticmethod
|
| 1537 |
+
@cache
|
| 1538 |
+
def is_alias(method):
|
| 1539 |
+
"""
|
| 1540 |
+
Return whether the object *method* is an alias for another method.
|
| 1541 |
+
"""
|
| 1542 |
+
|
| 1543 |
+
ds = inspect.getdoc(method)
|
| 1544 |
+
if ds is None:
|
| 1545 |
+
return False
|
| 1546 |
+
|
| 1547 |
+
return ds.startswith('Alias for ')
|
| 1548 |
+
|
| 1549 |
+
def aliased_name(self, s):
|
| 1550 |
+
"""
|
| 1551 |
+
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME'.
|
| 1552 |
+
|
| 1553 |
+
For example, for the line markerfacecolor property, which has an
|
| 1554 |
+
alias, return 'markerfacecolor or mfc' and for the transform
|
| 1555 |
+
property, which does not, return 'transform'.
|
| 1556 |
+
"""
|
| 1557 |
+
aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, [])))
|
| 1558 |
+
return s + aliases
|
| 1559 |
+
|
| 1560 |
+
_NOT_LINKABLE = {
|
| 1561 |
+
# A set of property setter methods that are not available in our
|
| 1562 |
+
# current docs. This is a workaround used to prevent trying to link
|
| 1563 |
+
# these setters which would lead to "target reference not found"
|
| 1564 |
+
# warnings during doc build.
|
| 1565 |
+
'matplotlib.image._ImageBase.set_alpha',
|
| 1566 |
+
'matplotlib.image._ImageBase.set_array',
|
| 1567 |
+
'matplotlib.image._ImageBase.set_data',
|
| 1568 |
+
'matplotlib.image._ImageBase.set_filternorm',
|
| 1569 |
+
'matplotlib.image._ImageBase.set_filterrad',
|
| 1570 |
+
'matplotlib.image._ImageBase.set_interpolation',
|
| 1571 |
+
'matplotlib.image._ImageBase.set_interpolation_stage',
|
| 1572 |
+
'matplotlib.image._ImageBase.set_resample',
|
| 1573 |
+
'matplotlib.text._AnnotationBase.set_annotation_clip',
|
| 1574 |
+
}
|
| 1575 |
+
|
| 1576 |
+
def aliased_name_rest(self, s, target):
|
| 1577 |
+
"""
|
| 1578 |
+
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME',
|
| 1579 |
+
formatted for reST.
|
| 1580 |
+
|
| 1581 |
+
For example, for the line markerfacecolor property, which has an
|
| 1582 |
+
alias, return 'markerfacecolor or mfc' and for the transform
|
| 1583 |
+
property, which does not, return 'transform'.
|
| 1584 |
+
"""
|
| 1585 |
+
# workaround to prevent "reference target not found"
|
| 1586 |
+
if target in self._NOT_LINKABLE:
|
| 1587 |
+
return f'``{s}``'
|
| 1588 |
+
|
| 1589 |
+
aliases = ''.join(
|
| 1590 |
+
f' or :meth:`{a} <{target}>`' for a in sorted(self.aliasd.get(s, [])))
|
| 1591 |
+
return f':meth:`{s} <{target}>`{aliases}'
|
| 1592 |
+
|
| 1593 |
+
def pprint_setters(self, prop=None, leadingspace=2):
|
| 1594 |
+
"""
|
| 1595 |
+
If *prop* is *None*, return a list of strings of all settable
|
| 1596 |
+
properties and their valid values.
|
| 1597 |
+
|
| 1598 |
+
If *prop* is not *None*, it is a valid property name and that
|
| 1599 |
+
property will be returned as a string of property : valid
|
| 1600 |
+
values.
|
| 1601 |
+
"""
|
| 1602 |
+
if leadingspace:
|
| 1603 |
+
pad = ' ' * leadingspace
|
| 1604 |
+
else:
|
| 1605 |
+
pad = ''
|
| 1606 |
+
if prop is not None:
|
| 1607 |
+
accepts = self.get_valid_values(prop)
|
| 1608 |
+
return f'{pad}{prop}: {accepts}'
|
| 1609 |
+
|
| 1610 |
+
lines = []
|
| 1611 |
+
for prop in sorted(self.get_setters()):
|
| 1612 |
+
accepts = self.get_valid_values(prop)
|
| 1613 |
+
name = self.aliased_name(prop)
|
| 1614 |
+
lines.append(f'{pad}{name}: {accepts}')
|
| 1615 |
+
return lines
|
| 1616 |
+
|
| 1617 |
+
def pprint_setters_rest(self, prop=None, leadingspace=4):
|
| 1618 |
+
"""
|
| 1619 |
+
If *prop* is *None*, return a list of reST-formatted strings of all
|
| 1620 |
+
settable properties and their valid values.
|
| 1621 |
+
|
| 1622 |
+
If *prop* is not *None*, it is a valid property name and that
|
| 1623 |
+
property will be returned as a string of "property : valid"
|
| 1624 |
+
values.
|
| 1625 |
+
"""
|
| 1626 |
+
if leadingspace:
|
| 1627 |
+
pad = ' ' * leadingspace
|
| 1628 |
+
else:
|
| 1629 |
+
pad = ''
|
| 1630 |
+
if prop is not None:
|
| 1631 |
+
accepts = self.get_valid_values(prop)
|
| 1632 |
+
return f'{pad}{prop}: {accepts}'
|
| 1633 |
+
|
| 1634 |
+
prop_and_qualnames = []
|
| 1635 |
+
for prop in sorted(self.get_setters()):
|
| 1636 |
+
# Find the parent method which actually provides the docstring.
|
| 1637 |
+
for cls in self.o.__mro__:
|
| 1638 |
+
method = getattr(cls, f"set_{prop}", None)
|
| 1639 |
+
if method and method.__doc__ is not None:
|
| 1640 |
+
break
|
| 1641 |
+
else: # No docstring available.
|
| 1642 |
+
method = getattr(self.o, f"set_{prop}")
|
| 1643 |
+
prop_and_qualnames.append(
|
| 1644 |
+
(prop, f"{method.__module__}.{method.__qualname__}"))
|
| 1645 |
+
|
| 1646 |
+
names = [self.aliased_name_rest(prop, target)
|
| 1647 |
+
.replace('_base._AxesBase', 'Axes')
|
| 1648 |
+
.replace('_axes.Axes', 'Axes')
|
| 1649 |
+
for prop, target in prop_and_qualnames]
|
| 1650 |
+
accepts = [self.get_valid_values(prop)
|
| 1651 |
+
for prop, _ in prop_and_qualnames]
|
| 1652 |
+
|
| 1653 |
+
col0_len = max(len(n) for n in names)
|
| 1654 |
+
col1_len = max(len(a) for a in accepts)
|
| 1655 |
+
table_formatstr = pad + ' ' + '=' * col0_len + ' ' + '=' * col1_len
|
| 1656 |
+
|
| 1657 |
+
return [
|
| 1658 |
+
'',
|
| 1659 |
+
pad + '.. table::',
|
| 1660 |
+
pad + ' :class: property-table',
|
| 1661 |
+
'',
|
| 1662 |
+
table_formatstr,
|
| 1663 |
+
pad + ' ' + 'Property'.ljust(col0_len)
|
| 1664 |
+
+ ' ' + 'Description'.ljust(col1_len),
|
| 1665 |
+
table_formatstr,
|
| 1666 |
+
*[pad + ' ' + n.ljust(col0_len) + ' ' + a.ljust(col1_len)
|
| 1667 |
+
for n, a in zip(names, accepts)],
|
| 1668 |
+
table_formatstr,
|
| 1669 |
+
'',
|
| 1670 |
+
]
|
| 1671 |
+
|
| 1672 |
+
def properties(self):
|
| 1673 |
+
"""Return a dictionary mapping property name -> value."""
|
| 1674 |
+
o = self.oorig
|
| 1675 |
+
getters = [name for name in dir(o)
|
| 1676 |
+
if name.startswith('get_') and callable(getattr(o, name))]
|
| 1677 |
+
getters.sort()
|
| 1678 |
+
d = {}
|
| 1679 |
+
for name in getters:
|
| 1680 |
+
func = getattr(o, name)
|
| 1681 |
+
if self.is_alias(func):
|
| 1682 |
+
continue
|
| 1683 |
+
try:
|
| 1684 |
+
with warnings.catch_warnings():
|
| 1685 |
+
warnings.simplefilter('ignore')
|
| 1686 |
+
val = func()
|
| 1687 |
+
except Exception:
|
| 1688 |
+
continue
|
| 1689 |
+
else:
|
| 1690 |
+
d[name[4:]] = val
|
| 1691 |
+
return d
|
| 1692 |
+
|
| 1693 |
+
def pprint_getters(self):
|
| 1694 |
+
"""Return the getters and actual values as list of strings."""
|
| 1695 |
+
lines = []
|
| 1696 |
+
for name, val in sorted(self.properties().items()):
|
| 1697 |
+
if getattr(val, 'shape', ()) != () and len(val) > 6:
|
| 1698 |
+
s = str(val[:6]) + '...'
|
| 1699 |
+
else:
|
| 1700 |
+
s = str(val)
|
| 1701 |
+
s = s.replace('\n', ' ')
|
| 1702 |
+
if len(s) > 50:
|
| 1703 |
+
s = s[:50] + '...'
|
| 1704 |
+
name = self.aliased_name(name)
|
| 1705 |
+
lines.append(f' {name} = {s}')
|
| 1706 |
+
return lines
|
| 1707 |
+
|
| 1708 |
+
|
| 1709 |
+
def getp(obj, property=None):
|
| 1710 |
+
"""
|
| 1711 |
+
Return the value of an `.Artist`'s *property*, or print all of them.
|
| 1712 |
+
|
| 1713 |
+
Parameters
|
| 1714 |
+
----------
|
| 1715 |
+
obj : `~matplotlib.artist.Artist`
|
| 1716 |
+
The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`.
|
| 1717 |
+
|
| 1718 |
+
property : str or None, default: None
|
| 1719 |
+
If *property* is 'somename', this function returns
|
| 1720 |
+
``obj.get_somename()``.
|
| 1721 |
+
|
| 1722 |
+
If it's None (or unset), it *prints* all gettable properties from
|
| 1723 |
+
*obj*. Many properties have aliases for shorter typing, e.g. 'lw' is
|
| 1724 |
+
an alias for 'linewidth'. In the output, aliases and full property
|
| 1725 |
+
names will be listed as:
|
| 1726 |
+
|
| 1727 |
+
property or alias = value
|
| 1728 |
+
|
| 1729 |
+
e.g.:
|
| 1730 |
+
|
| 1731 |
+
linewidth or lw = 2
|
| 1732 |
+
|
| 1733 |
+
See Also
|
| 1734 |
+
--------
|
| 1735 |
+
setp
|
| 1736 |
+
"""
|
| 1737 |
+
if property is None:
|
| 1738 |
+
insp = ArtistInspector(obj)
|
| 1739 |
+
ret = insp.pprint_getters()
|
| 1740 |
+
print('\n'.join(ret))
|
| 1741 |
+
return
|
| 1742 |
+
return getattr(obj, 'get_' + property)()
|
| 1743 |
+
|
| 1744 |
+
# alias
|
| 1745 |
+
get = getp
|
| 1746 |
+
|
| 1747 |
+
|
| 1748 |
+
def setp(obj, *args, file=None, **kwargs):
|
| 1749 |
+
"""
|
| 1750 |
+
Set one or more properties on an `.Artist`, or list allowed values.
|
| 1751 |
+
|
| 1752 |
+
Parameters
|
| 1753 |
+
----------
|
| 1754 |
+
obj : `~matplotlib.artist.Artist` or list of `.Artist`
|
| 1755 |
+
The artist(s) whose properties are being set or queried. When setting
|
| 1756 |
+
properties, all artists are affected; when querying the allowed values,
|
| 1757 |
+
only the first instance in the sequence is queried.
|
| 1758 |
+
|
| 1759 |
+
For example, two lines can be made thicker and red with a single call:
|
| 1760 |
+
|
| 1761 |
+
>>> x = arange(0, 1, 0.01)
|
| 1762 |
+
>>> lines = plot(x, sin(2*pi*x), x, sin(4*pi*x))
|
| 1763 |
+
>>> setp(lines, linewidth=2, color='r')
|
| 1764 |
+
|
| 1765 |
+
file : file-like, default: `sys.stdout`
|
| 1766 |
+
Where `setp` writes its output when asked to list allowed values.
|
| 1767 |
+
|
| 1768 |
+
>>> with open('output.log') as file:
|
| 1769 |
+
... setp(line, file=file)
|
| 1770 |
+
|
| 1771 |
+
The default, ``None``, means `sys.stdout`.
|
| 1772 |
+
|
| 1773 |
+
*args, **kwargs
|
| 1774 |
+
The properties to set. The following combinations are supported:
|
| 1775 |
+
|
| 1776 |
+
- Set the linestyle of a line to be dashed:
|
| 1777 |
+
|
| 1778 |
+
>>> line, = plot([1, 2, 3])
|
| 1779 |
+
>>> setp(line, linestyle='--')
|
| 1780 |
+
|
| 1781 |
+
- Set multiple properties at once:
|
| 1782 |
+
|
| 1783 |
+
>>> setp(line, linewidth=2, color='r')
|
| 1784 |
+
|
| 1785 |
+
- List allowed values for a line's linestyle:
|
| 1786 |
+
|
| 1787 |
+
>>> setp(line, 'linestyle')
|
| 1788 |
+
linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
|
| 1789 |
+
|
| 1790 |
+
- List all properties that can be set, and their allowed values:
|
| 1791 |
+
|
| 1792 |
+
>>> setp(line)
|
| 1793 |
+
agg_filter: a filter function, ...
|
| 1794 |
+
[long output listing omitted]
|
| 1795 |
+
|
| 1796 |
+
`setp` also supports MATLAB style string/value pairs. For example, the
|
| 1797 |
+
following are equivalent:
|
| 1798 |
+
|
| 1799 |
+
>>> setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style
|
| 1800 |
+
>>> setp(lines, linewidth=2, color='r') # Python style
|
| 1801 |
+
|
| 1802 |
+
See Also
|
| 1803 |
+
--------
|
| 1804 |
+
getp
|
| 1805 |
+
"""
|
| 1806 |
+
|
| 1807 |
+
if isinstance(obj, Artist):
|
| 1808 |
+
objs = [obj]
|
| 1809 |
+
else:
|
| 1810 |
+
objs = list(cbook.flatten(obj))
|
| 1811 |
+
|
| 1812 |
+
if not objs:
|
| 1813 |
+
return
|
| 1814 |
+
|
| 1815 |
+
insp = ArtistInspector(objs[0])
|
| 1816 |
+
|
| 1817 |
+
if not kwargs and len(args) < 2:
|
| 1818 |
+
if args:
|
| 1819 |
+
print(insp.pprint_setters(prop=args[0]), file=file)
|
| 1820 |
+
else:
|
| 1821 |
+
print('\n'.join(insp.pprint_setters()), file=file)
|
| 1822 |
+
return
|
| 1823 |
+
|
| 1824 |
+
if len(args) % 2:
|
| 1825 |
+
raise ValueError('The set args must be string, value pairs')
|
| 1826 |
+
|
| 1827 |
+
funcvals = dict(zip(args[::2], args[1::2]))
|
| 1828 |
+
ret = [o.update(funcvals) for o in objs] + [o.set(**kwargs) for o in objs]
|
| 1829 |
+
return list(cbook.flatten(ret))
|
| 1830 |
+
|
| 1831 |
+
|
| 1832 |
+
def kwdoc(artist):
|
| 1833 |
+
r"""
|
| 1834 |
+
Inspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and
|
| 1835 |
+
return information about its settable properties and their current values.
|
| 1836 |
+
|
| 1837 |
+
Parameters
|
| 1838 |
+
----------
|
| 1839 |
+
artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s
|
| 1840 |
+
|
| 1841 |
+
Returns
|
| 1842 |
+
-------
|
| 1843 |
+
str
|
| 1844 |
+
The settable properties of *artist*, as plain text if
|
| 1845 |
+
:rc:`docstring.hardcopy` is False and as a rst table (intended for
|
| 1846 |
+
use in Sphinx) if it is True.
|
| 1847 |
+
"""
|
| 1848 |
+
ai = ArtistInspector(artist)
|
| 1849 |
+
return ('\n'.join(ai.pprint_setters_rest(leadingspace=4))
|
| 1850 |
+
if mpl.rcParams['docstring.hardcopy'] else
|
| 1851 |
+
'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
|
| 1852 |
+
|
| 1853 |
+
# We defer this to the end of them module, because it needs ArtistInspector
|
| 1854 |
+
# to be defined.
|
| 1855 |
+
Artist._update_set_signature_and_docstring()
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/artist.pyi
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .axes._base import _AxesBase
|
| 2 |
+
from .backend_bases import RendererBase, MouseEvent
|
| 3 |
+
from .figure import Figure, SubFigure
|
| 4 |
+
from .path import Path
|
| 5 |
+
from .patches import Patch
|
| 6 |
+
from .patheffects import AbstractPathEffect
|
| 7 |
+
from .transforms import (
|
| 8 |
+
BboxBase,
|
| 9 |
+
Bbox,
|
| 10 |
+
Transform,
|
| 11 |
+
TransformedPatchPath,
|
| 12 |
+
TransformedPath,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
|
| 17 |
+
from collections.abc import Callable, Iterable
|
| 18 |
+
from typing import Any, Literal, NamedTuple, TextIO, overload, TypeVar
|
| 19 |
+
from numpy.typing import ArrayLike
|
| 20 |
+
|
| 21 |
+
_T_Artist = TypeVar("_T_Artist", bound=Artist)
|
| 22 |
+
|
| 23 |
+
def allow_rasterization(draw): ...
|
| 24 |
+
|
| 25 |
+
class _XYPair(NamedTuple):
|
| 26 |
+
x: ArrayLike
|
| 27 |
+
y: ArrayLike
|
| 28 |
+
|
| 29 |
+
class _Unset: ...
|
| 30 |
+
|
| 31 |
+
class Artist:
|
| 32 |
+
zorder: float
|
| 33 |
+
stale_callback: Callable[[Artist, bool], None] | None
|
| 34 |
+
@property
|
| 35 |
+
def figure(self) -> Figure | SubFigure: ...
|
| 36 |
+
clipbox: BboxBase | None
|
| 37 |
+
def __init__(self) -> None: ...
|
| 38 |
+
def remove(self) -> None: ...
|
| 39 |
+
def have_units(self) -> bool: ...
|
| 40 |
+
# TODO units
|
| 41 |
+
def convert_xunits(self, x): ...
|
| 42 |
+
def convert_yunits(self, y): ...
|
| 43 |
+
@property
|
| 44 |
+
def axes(self) -> _AxesBase | None: ...
|
| 45 |
+
@axes.setter
|
| 46 |
+
def axes(self, new_axes: _AxesBase | None) -> None: ...
|
| 47 |
+
@property
|
| 48 |
+
def stale(self) -> bool: ...
|
| 49 |
+
@stale.setter
|
| 50 |
+
def stale(self, val: bool) -> None: ...
|
| 51 |
+
def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
|
| 52 |
+
def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox | None: ...
|
| 53 |
+
def add_callback(self, func: Callable[[Artist], Any]) -> int: ...
|
| 54 |
+
def remove_callback(self, oid: int) -> None: ...
|
| 55 |
+
def pchanged(self) -> None: ...
|
| 56 |
+
def is_transform_set(self) -> bool: ...
|
| 57 |
+
def set_transform(self, t: Transform | None) -> None: ...
|
| 58 |
+
def get_transform(self) -> Transform: ...
|
| 59 |
+
def get_children(self) -> list[Artist]: ...
|
| 60 |
+
# TODO can these dicts be type narrowed? e.g. str keys
|
| 61 |
+
def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ...
|
| 62 |
+
def pickable(self) -> bool: ...
|
| 63 |
+
def pick(self, mouseevent: MouseEvent) -> None: ...
|
| 64 |
+
def set_picker(
|
| 65 |
+
self,
|
| 66 |
+
picker: None
|
| 67 |
+
| bool
|
| 68 |
+
| float
|
| 69 |
+
| Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]],
|
| 70 |
+
) -> None: ...
|
| 71 |
+
def get_picker(
|
| 72 |
+
self,
|
| 73 |
+
) -> None | bool | float | Callable[
|
| 74 |
+
[Artist, MouseEvent], tuple[bool, dict[Any, Any]]
|
| 75 |
+
]: ...
|
| 76 |
+
def get_url(self) -> str | None: ...
|
| 77 |
+
def set_url(self, url: str | None) -> None: ...
|
| 78 |
+
def get_gid(self) -> str | None: ...
|
| 79 |
+
def set_gid(self, gid: str | None) -> None: ...
|
| 80 |
+
def get_snap(self) -> bool | None: ...
|
| 81 |
+
def set_snap(self, snap: bool | None) -> None: ...
|
| 82 |
+
def get_sketch_params(self) -> tuple[float, float, float] | None: ...
|
| 83 |
+
def set_sketch_params(
|
| 84 |
+
self,
|
| 85 |
+
scale: float | None = ...,
|
| 86 |
+
length: float | None = ...,
|
| 87 |
+
randomness: float | None = ...,
|
| 88 |
+
) -> None: ...
|
| 89 |
+
def set_path_effects(self, path_effects: list[AbstractPathEffect]) -> None: ...
|
| 90 |
+
def get_path_effects(self) -> list[AbstractPathEffect]: ...
|
| 91 |
+
@overload
|
| 92 |
+
def get_figure(self, root: Literal[True]) -> Figure | None: ...
|
| 93 |
+
@overload
|
| 94 |
+
def get_figure(self, root: Literal[False]) -> Figure | SubFigure | None: ...
|
| 95 |
+
@overload
|
| 96 |
+
def get_figure(self, root: bool = ...) -> Figure | SubFigure | None: ...
|
| 97 |
+
def set_figure(self, fig: Figure | SubFigure) -> None: ...
|
| 98 |
+
def set_clip_box(self, clipbox: BboxBase | None) -> None: ...
|
| 99 |
+
def set_clip_path(
|
| 100 |
+
self,
|
| 101 |
+
path: Patch | Path | TransformedPath | TransformedPatchPath | None,
|
| 102 |
+
transform: Transform | None = ...,
|
| 103 |
+
) -> None: ...
|
| 104 |
+
def get_alpha(self) -> float | None: ...
|
| 105 |
+
def get_visible(self) -> bool: ...
|
| 106 |
+
def get_animated(self) -> bool: ...
|
| 107 |
+
def get_in_layout(self) -> bool: ...
|
| 108 |
+
def get_clip_on(self) -> bool: ...
|
| 109 |
+
def get_clip_box(self) -> Bbox | None: ...
|
| 110 |
+
def get_clip_path(
|
| 111 |
+
self,
|
| 112 |
+
) -> Patch | Path | TransformedPath | TransformedPatchPath | None: ...
|
| 113 |
+
def get_transformed_clip_path_and_affine(
|
| 114 |
+
self,
|
| 115 |
+
) -> tuple[None, None] | tuple[Path, Transform]: ...
|
| 116 |
+
def set_clip_on(self, b: bool) -> None: ...
|
| 117 |
+
def get_rasterized(self) -> bool: ...
|
| 118 |
+
def set_rasterized(self, rasterized: bool) -> None: ...
|
| 119 |
+
def get_agg_filter(self) -> Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None: ...
|
| 120 |
+
def set_agg_filter(
|
| 121 |
+
self, filter_func: Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None
|
| 122 |
+
) -> None: ...
|
| 123 |
+
def draw(self, renderer: RendererBase) -> None: ...
|
| 124 |
+
def set_alpha(self, alpha: float | None) -> None: ...
|
| 125 |
+
def set_visible(self, b: bool) -> None: ...
|
| 126 |
+
def set_animated(self, b: bool) -> None: ...
|
| 127 |
+
def set_in_layout(self, in_layout: bool) -> None: ...
|
| 128 |
+
def get_label(self) -> object: ...
|
| 129 |
+
def set_label(self, s: object) -> None: ...
|
| 130 |
+
def get_zorder(self) -> float: ...
|
| 131 |
+
def set_zorder(self, level: float) -> None: ...
|
| 132 |
+
@property
|
| 133 |
+
def sticky_edges(self) -> _XYPair: ...
|
| 134 |
+
def update_from(self, other: Artist) -> None: ...
|
| 135 |
+
def properties(self) -> dict[str, Any]: ...
|
| 136 |
+
def update(self, props: dict[str, Any]) -> list[Any]: ...
|
| 137 |
+
def _internal_update(self, kwargs: Any) -> list[Any]: ...
|
| 138 |
+
def set(self, **kwargs: Any) -> list[Any]: ...
|
| 139 |
+
|
| 140 |
+
@overload
|
| 141 |
+
def findobj(
|
| 142 |
+
self,
|
| 143 |
+
match: None | Callable[[Artist], bool] = ...,
|
| 144 |
+
include_self: bool = ...,
|
| 145 |
+
) -> list[Artist]: ...
|
| 146 |
+
|
| 147 |
+
@overload
|
| 148 |
+
def findobj(
|
| 149 |
+
self,
|
| 150 |
+
match: type[_T_Artist],
|
| 151 |
+
include_self: bool = ...,
|
| 152 |
+
) -> list[_T_Artist]: ...
|
| 153 |
+
|
| 154 |
+
def get_cursor_data(self, event: MouseEvent) -> Any: ...
|
| 155 |
+
def format_cursor_data(self, data: Any) -> str: ...
|
| 156 |
+
def get_mouseover(self) -> bool: ...
|
| 157 |
+
def set_mouseover(self, mouseover: bool) -> None: ...
|
| 158 |
+
@property
|
| 159 |
+
def mouseover(self) -> bool: ...
|
| 160 |
+
@mouseover.setter
|
| 161 |
+
def mouseover(self, mouseover: bool) -> None: ...
|
| 162 |
+
|
| 163 |
+
class ArtistInspector:
|
| 164 |
+
oorig: Artist | type[Artist]
|
| 165 |
+
o: type[Artist]
|
| 166 |
+
aliasd: dict[str, set[str]]
|
| 167 |
+
def __init__(
|
| 168 |
+
self, o: Artist | type[Artist] | Iterable[Artist | type[Artist]]
|
| 169 |
+
) -> None: ...
|
| 170 |
+
def get_aliases(self) -> dict[str, set[str]]: ...
|
| 171 |
+
def get_valid_values(self, attr: str) -> str | None: ...
|
| 172 |
+
def get_setters(self) -> list[str]: ...
|
| 173 |
+
@staticmethod
|
| 174 |
+
def number_of_parameters(func: Callable) -> int: ...
|
| 175 |
+
@staticmethod
|
| 176 |
+
def is_alias(method: Callable) -> bool: ...
|
| 177 |
+
def aliased_name(self, s: str) -> str: ...
|
| 178 |
+
def aliased_name_rest(self, s: str, target: str) -> str: ...
|
| 179 |
+
@overload
|
| 180 |
+
def pprint_setters(
|
| 181 |
+
self, prop: None = ..., leadingspace: int = ...
|
| 182 |
+
) -> list[str]: ...
|
| 183 |
+
@overload
|
| 184 |
+
def pprint_setters(self, prop: str, leadingspace: int = ...) -> str: ...
|
| 185 |
+
@overload
|
| 186 |
+
def pprint_setters_rest(
|
| 187 |
+
self, prop: None = ..., leadingspace: int = ...
|
| 188 |
+
) -> list[str]: ...
|
| 189 |
+
@overload
|
| 190 |
+
def pprint_setters_rest(self, prop: str, leadingspace: int = ...) -> str: ...
|
| 191 |
+
def properties(self) -> dict[str, Any]: ...
|
| 192 |
+
def pprint_getters(self) -> list[str]: ...
|
| 193 |
+
|
| 194 |
+
def getp(obj: Artist, property: str | None = ...) -> Any: ...
|
| 195 |
+
|
| 196 |
+
get = getp
|
| 197 |
+
|
| 198 |
+
def setp(obj: Artist, *args, file: TextIO | None = ..., **kwargs) -> list[Any] | None: ...
|
| 199 |
+
def kwdoc(artist: Artist | type[Artist] | Iterable[Artist | type[Artist]]) -> str: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/axis.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/axis.pyi
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable, Iterable, Sequence
|
| 2 |
+
import datetime
|
| 3 |
+
from typing import Any, Literal, overload
|
| 4 |
+
from typing_extensions import Self # < Py 3.11
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
from numpy.typing import ArrayLike
|
| 8 |
+
|
| 9 |
+
import matplotlib.artist as martist
|
| 10 |
+
from matplotlib import cbook
|
| 11 |
+
from matplotlib.axes import Axes
|
| 12 |
+
from matplotlib.backend_bases import RendererBase
|
| 13 |
+
from matplotlib.lines import Line2D
|
| 14 |
+
from matplotlib.text import Text
|
| 15 |
+
from matplotlib.ticker import Locator, Formatter
|
| 16 |
+
from matplotlib.transforms import Transform, Bbox
|
| 17 |
+
from matplotlib.typing import ColorType
|
| 18 |
+
from matplotlib.units import ConversionInterface
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
GRIDLINE_INTERPOLATION_STEPS: int
|
| 22 |
+
|
| 23 |
+
class Tick(martist.Artist):
|
| 24 |
+
axes: Axes
|
| 25 |
+
tick1line: Line2D
|
| 26 |
+
tick2line: Line2D
|
| 27 |
+
gridline: Line2D
|
| 28 |
+
label1: Text
|
| 29 |
+
label2: Text
|
| 30 |
+
def __init__(
|
| 31 |
+
self,
|
| 32 |
+
axes: Axes,
|
| 33 |
+
loc: float,
|
| 34 |
+
*,
|
| 35 |
+
size: float | None = ...,
|
| 36 |
+
width: float | None = ...,
|
| 37 |
+
color: ColorType | None = ...,
|
| 38 |
+
tickdir: Literal["in", "inout", "out"] | None = ...,
|
| 39 |
+
pad: float | None = ...,
|
| 40 |
+
labelsize: float | None = ...,
|
| 41 |
+
labelcolor: ColorType | None = ...,
|
| 42 |
+
labelfontfamily: str | Sequence[str] | None = ...,
|
| 43 |
+
zorder: float | None = ...,
|
| 44 |
+
gridOn: bool | None = ...,
|
| 45 |
+
tick1On: bool = ...,
|
| 46 |
+
tick2On: bool = ...,
|
| 47 |
+
label1On: bool = ...,
|
| 48 |
+
label2On: bool = ...,
|
| 49 |
+
major: bool = ...,
|
| 50 |
+
labelrotation: float = ...,
|
| 51 |
+
grid_color: ColorType | None = ...,
|
| 52 |
+
grid_linestyle: str | None = ...,
|
| 53 |
+
grid_linewidth: float | None = ...,
|
| 54 |
+
grid_alpha: float | None = ...,
|
| 55 |
+
**kwargs
|
| 56 |
+
) -> None: ...
|
| 57 |
+
def get_tickdir(self) -> Literal["in", "inout", "out"]: ...
|
| 58 |
+
def get_tick_padding(self) -> float: ...
|
| 59 |
+
def get_children(self) -> list[martist.Artist]: ...
|
| 60 |
+
stale: bool
|
| 61 |
+
def set_pad(self, val: float) -> None: ...
|
| 62 |
+
def get_pad(self) -> None: ...
|
| 63 |
+
def get_loc(self) -> float: ...
|
| 64 |
+
def set_url(self, url: str | None) -> None: ...
|
| 65 |
+
def get_view_interval(self) -> ArrayLike: ...
|
| 66 |
+
def update_position(self, loc: float) -> None: ...
|
| 67 |
+
|
| 68 |
+
class XTick(Tick):
|
| 69 |
+
__name__: str
|
| 70 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 71 |
+
stale: bool
|
| 72 |
+
def update_position(self, loc: float) -> None: ...
|
| 73 |
+
def get_view_interval(self) -> np.ndarray: ...
|
| 74 |
+
|
| 75 |
+
class YTick(Tick):
|
| 76 |
+
__name__: str
|
| 77 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 78 |
+
stale: bool
|
| 79 |
+
def update_position(self, loc: float) -> None: ...
|
| 80 |
+
def get_view_interval(self) -> np.ndarray: ...
|
| 81 |
+
|
| 82 |
+
class Ticker:
|
| 83 |
+
def __init__(self) -> None: ...
|
| 84 |
+
@property
|
| 85 |
+
def locator(self) -> Locator | None: ...
|
| 86 |
+
@locator.setter
|
| 87 |
+
def locator(self, locator: Locator) -> None: ...
|
| 88 |
+
@property
|
| 89 |
+
def formatter(self) -> Formatter | None: ...
|
| 90 |
+
@formatter.setter
|
| 91 |
+
def formatter(self, formatter: Formatter) -> None: ...
|
| 92 |
+
|
| 93 |
+
class _LazyTickList:
|
| 94 |
+
def __init__(self, major: bool) -> None: ...
|
| 95 |
+
@overload
|
| 96 |
+
def __get__(self, instance: None, owner: None) -> Self: ...
|
| 97 |
+
@overload
|
| 98 |
+
def __get__(self, instance: Axis, owner: type[Axis]) -> list[Tick]: ...
|
| 99 |
+
|
| 100 |
+
class Axis(martist.Artist):
|
| 101 |
+
OFFSETTEXTPAD: int
|
| 102 |
+
isDefault_label: bool
|
| 103 |
+
axes: Axes
|
| 104 |
+
major: Ticker
|
| 105 |
+
minor: Ticker
|
| 106 |
+
callbacks: cbook.CallbackRegistry
|
| 107 |
+
label: Text
|
| 108 |
+
offsetText: Text
|
| 109 |
+
labelpad: float
|
| 110 |
+
pickradius: float
|
| 111 |
+
def __init__(self, axes, *, pickradius: float = ...,
|
| 112 |
+
clear: bool = ...) -> None: ...
|
| 113 |
+
@property
|
| 114 |
+
def isDefault_majloc(self) -> bool: ...
|
| 115 |
+
@isDefault_majloc.setter
|
| 116 |
+
def isDefault_majloc(self, value: bool) -> None: ...
|
| 117 |
+
@property
|
| 118 |
+
def isDefault_majfmt(self) -> bool: ...
|
| 119 |
+
@isDefault_majfmt.setter
|
| 120 |
+
def isDefault_majfmt(self, value: bool) -> None: ...
|
| 121 |
+
@property
|
| 122 |
+
def isDefault_minloc(self) -> bool: ...
|
| 123 |
+
@isDefault_minloc.setter
|
| 124 |
+
def isDefault_minloc(self, value: bool) -> None: ...
|
| 125 |
+
@property
|
| 126 |
+
def isDefault_minfmt(self) -> bool: ...
|
| 127 |
+
@isDefault_minfmt.setter
|
| 128 |
+
def isDefault_minfmt(self, value: bool) -> None: ...
|
| 129 |
+
majorTicks: _LazyTickList
|
| 130 |
+
minorTicks: _LazyTickList
|
| 131 |
+
def get_remove_overlapping_locs(self) -> bool: ...
|
| 132 |
+
def set_remove_overlapping_locs(self, val: bool) -> None: ...
|
| 133 |
+
@property
|
| 134 |
+
def remove_overlapping_locs(self) -> bool: ...
|
| 135 |
+
@remove_overlapping_locs.setter
|
| 136 |
+
def remove_overlapping_locs(self, val: bool) -> None: ...
|
| 137 |
+
stale: bool
|
| 138 |
+
def set_label_coords(
|
| 139 |
+
self, x: float, y: float, transform: Transform | None = ...
|
| 140 |
+
) -> None: ...
|
| 141 |
+
def get_transform(self) -> Transform: ...
|
| 142 |
+
def get_scale(self) -> str: ...
|
| 143 |
+
def limit_range_for_scale(
|
| 144 |
+
self, vmin: float, vmax: float
|
| 145 |
+
) -> tuple[float, float]: ...
|
| 146 |
+
def get_children(self) -> list[martist.Artist]: ...
|
| 147 |
+
# TODO units
|
| 148 |
+
converter: Any
|
| 149 |
+
units: Any
|
| 150 |
+
def clear(self) -> None: ...
|
| 151 |
+
def reset_ticks(self) -> None: ...
|
| 152 |
+
def minorticks_on(self) -> None: ...
|
| 153 |
+
def minorticks_off(self) -> None: ...
|
| 154 |
+
def set_tick_params(
|
| 155 |
+
self,
|
| 156 |
+
which: Literal["major", "minor", "both"] = ...,
|
| 157 |
+
reset: bool = ...,
|
| 158 |
+
**kwargs
|
| 159 |
+
) -> None: ...
|
| 160 |
+
def get_tick_params(
|
| 161 |
+
self, which: Literal["major", "minor"] = ...
|
| 162 |
+
) -> dict[str, Any]: ...
|
| 163 |
+
def get_view_interval(self) -> tuple[float, float]: ...
|
| 164 |
+
def set_view_interval(
|
| 165 |
+
self, vmin: float, vmax: float, ignore: bool = ...
|
| 166 |
+
) -> None: ...
|
| 167 |
+
def get_data_interval(self) -> tuple[float, float]: ...
|
| 168 |
+
def set_data_interval(
|
| 169 |
+
self, vmin: float, vmax: float, ignore: bool = ...
|
| 170 |
+
) -> None: ...
|
| 171 |
+
def get_inverted(self) -> bool: ...
|
| 172 |
+
def set_inverted(self, inverted: bool) -> None: ...
|
| 173 |
+
def set_default_intervals(self) -> None: ...
|
| 174 |
+
def get_tightbbox(
|
| 175 |
+
self, renderer: RendererBase | None = ..., *, for_layout_only: bool = ...
|
| 176 |
+
) -> Bbox | None: ...
|
| 177 |
+
def get_tick_padding(self) -> float: ...
|
| 178 |
+
def get_gridlines(self) -> list[Line2D]: ...
|
| 179 |
+
def get_label(self) -> Text: ...
|
| 180 |
+
def get_offset_text(self) -> Text: ...
|
| 181 |
+
def get_pickradius(self) -> float: ...
|
| 182 |
+
def get_majorticklabels(self) -> list[Text]: ...
|
| 183 |
+
def get_minorticklabels(self) -> list[Text]: ...
|
| 184 |
+
def get_ticklabels(
|
| 185 |
+
self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
|
| 186 |
+
) -> list[Text]: ...
|
| 187 |
+
def get_majorticklines(self) -> list[Line2D]: ...
|
| 188 |
+
def get_minorticklines(self) -> list[Line2D]: ...
|
| 189 |
+
def get_ticklines(self, minor: bool = ...) -> list[Line2D]: ...
|
| 190 |
+
def get_majorticklocs(self) -> np.ndarray: ...
|
| 191 |
+
def get_minorticklocs(self) -> np.ndarray: ...
|
| 192 |
+
def get_ticklocs(self, *, minor: bool = ...) -> np.ndarray: ...
|
| 193 |
+
def get_ticks_direction(self, minor: bool = ...) -> np.ndarray: ...
|
| 194 |
+
def get_label_text(self) -> str: ...
|
| 195 |
+
def get_major_locator(self) -> Locator: ...
|
| 196 |
+
def get_minor_locator(self) -> Locator: ...
|
| 197 |
+
def get_major_formatter(self) -> Formatter: ...
|
| 198 |
+
def get_minor_formatter(self) -> Formatter: ...
|
| 199 |
+
def get_major_ticks(self, numticks: int | None = ...) -> list[Tick]: ...
|
| 200 |
+
def get_minor_ticks(self, numticks: int | None = ...) -> list[Tick]: ...
|
| 201 |
+
def grid(
|
| 202 |
+
self,
|
| 203 |
+
visible: bool | None = ...,
|
| 204 |
+
which: Literal["major", "minor", "both"] = ...,
|
| 205 |
+
**kwargs
|
| 206 |
+
) -> None: ...
|
| 207 |
+
# TODO units
|
| 208 |
+
def update_units(self, data): ...
|
| 209 |
+
def have_units(self) -> bool: ...
|
| 210 |
+
def convert_units(self, x): ...
|
| 211 |
+
def get_converter(self) -> ConversionInterface | None: ...
|
| 212 |
+
def set_converter(self, converter: ConversionInterface) -> None: ...
|
| 213 |
+
def set_units(self, u) -> None: ...
|
| 214 |
+
def get_units(self): ...
|
| 215 |
+
def set_label_text(
|
| 216 |
+
self, label: str, fontdict: dict[str, Any] | None = ..., **kwargs
|
| 217 |
+
) -> Text: ...
|
| 218 |
+
def set_major_formatter(
|
| 219 |
+
self, formatter: Formatter | str | Callable[[float, float], str]
|
| 220 |
+
) -> None: ...
|
| 221 |
+
def set_minor_formatter(
|
| 222 |
+
self, formatter: Formatter | str | Callable[[float, float], str]
|
| 223 |
+
) -> None: ...
|
| 224 |
+
def set_major_locator(self, locator: Locator) -> None: ...
|
| 225 |
+
def set_minor_locator(self, locator: Locator) -> None: ...
|
| 226 |
+
def set_pickradius(self, pickradius: float) -> None: ...
|
| 227 |
+
def set_ticklabels(
|
| 228 |
+
self,
|
| 229 |
+
labels: Iterable[str | Text],
|
| 230 |
+
*,
|
| 231 |
+
minor: bool = ...,
|
| 232 |
+
fontdict: dict[str, Any] | None = ...,
|
| 233 |
+
**kwargs
|
| 234 |
+
) -> list[Text]: ...
|
| 235 |
+
def set_ticks(
|
| 236 |
+
self,
|
| 237 |
+
ticks: ArrayLike,
|
| 238 |
+
labels: Iterable[str] | None = ...,
|
| 239 |
+
*,
|
| 240 |
+
minor: bool = ...,
|
| 241 |
+
**kwargs
|
| 242 |
+
) -> list[Tick]: ...
|
| 243 |
+
def axis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
|
| 244 |
+
def get_tick_space(self) -> int: ...
|
| 245 |
+
def get_label_position(self) -> Literal["top", "bottom"]: ...
|
| 246 |
+
def set_label_position(
|
| 247 |
+
self, position: Literal["top", "bottom", "left", "right"]
|
| 248 |
+
) -> None: ...
|
| 249 |
+
def get_minpos(self) -> float: ...
|
| 250 |
+
|
| 251 |
+
class XAxis(Axis):
|
| 252 |
+
__name__: str
|
| 253 |
+
axis_name: str
|
| 254 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 255 |
+
label_position: Literal["bottom", "top"]
|
| 256 |
+
stale: bool
|
| 257 |
+
def set_label_position(self, position: Literal["bottom", "top"]) -> None: ... # type: ignore[override]
|
| 258 |
+
def set_ticks_position(
|
| 259 |
+
self, position: Literal["top", "bottom", "both", "default", "none"]
|
| 260 |
+
) -> None: ...
|
| 261 |
+
def tick_top(self) -> None: ...
|
| 262 |
+
def tick_bottom(self) -> None: ...
|
| 263 |
+
def get_ticks_position(self) -> Literal["top", "bottom", "default", "unknown"]: ...
|
| 264 |
+
def get_tick_space(self) -> int: ...
|
| 265 |
+
|
| 266 |
+
class YAxis(Axis):
|
| 267 |
+
__name__: str
|
| 268 |
+
axis_name: str
|
| 269 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 270 |
+
label_position: Literal["left", "right"]
|
| 271 |
+
stale: bool
|
| 272 |
+
def set_label_position(self, position: Literal["left", "right"]) -> None: ... # type: ignore[override]
|
| 273 |
+
def set_offset_position(self, position: Literal["left", "right"]) -> None: ...
|
| 274 |
+
def set_ticks_position(
|
| 275 |
+
self, position: Literal["left", "right", "both", "default", "none"]
|
| 276 |
+
) -> None: ...
|
| 277 |
+
def tick_right(self) -> None: ...
|
| 278 |
+
def tick_left(self) -> None: ...
|
| 279 |
+
def get_ticks_position(self) -> Literal["left", "right", "default", "unknown"]: ...
|
| 280 |
+
def get_tick_space(self) -> int: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_bases.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_bases.pyi
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import Enum, IntEnum
|
| 2 |
+
import os
|
| 3 |
+
from matplotlib import (
|
| 4 |
+
cbook,
|
| 5 |
+
transforms,
|
| 6 |
+
widgets,
|
| 7 |
+
_api,
|
| 8 |
+
)
|
| 9 |
+
from matplotlib.artist import Artist
|
| 10 |
+
from matplotlib.axes import Axes
|
| 11 |
+
from matplotlib.backend_managers import ToolManager
|
| 12 |
+
from matplotlib.backend_tools import Cursors, ToolBase
|
| 13 |
+
from matplotlib.colorbar import Colorbar
|
| 14 |
+
from matplotlib.figure import Figure
|
| 15 |
+
from matplotlib.font_manager import FontProperties
|
| 16 |
+
from matplotlib.path import Path
|
| 17 |
+
from matplotlib.texmanager import TexManager
|
| 18 |
+
from matplotlib.text import Text
|
| 19 |
+
from matplotlib.transforms import Bbox, BboxBase, Transform, TransformedPath
|
| 20 |
+
|
| 21 |
+
from collections.abc import Callable, Iterable, Sequence
|
| 22 |
+
from typing import Any, IO, Literal, NamedTuple, TypeVar
|
| 23 |
+
from numpy.typing import ArrayLike
|
| 24 |
+
from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType
|
| 25 |
+
|
| 26 |
+
def register_backend(
|
| 27 |
+
format: str, backend: str | type[FigureCanvasBase], description: str | None = ...
|
| 28 |
+
) -> None: ...
|
| 29 |
+
def get_registered_canvas_class(format: str) -> type[FigureCanvasBase]: ...
|
| 30 |
+
|
| 31 |
+
class RendererBase:
|
| 32 |
+
def __init__(self) -> None: ...
|
| 33 |
+
def open_group(self, s: str, gid: str | None = ...) -> None: ...
|
| 34 |
+
def close_group(self, s: str) -> None: ...
|
| 35 |
+
def draw_path(
|
| 36 |
+
self,
|
| 37 |
+
gc: GraphicsContextBase,
|
| 38 |
+
path: Path,
|
| 39 |
+
transform: Transform,
|
| 40 |
+
rgbFace: ColorType | None = ...,
|
| 41 |
+
) -> None: ...
|
| 42 |
+
def draw_markers(
|
| 43 |
+
self,
|
| 44 |
+
gc: GraphicsContextBase,
|
| 45 |
+
marker_path: Path,
|
| 46 |
+
marker_trans: Transform,
|
| 47 |
+
path: Path,
|
| 48 |
+
trans: Transform,
|
| 49 |
+
rgbFace: ColorType | None = ...,
|
| 50 |
+
) -> None: ...
|
| 51 |
+
def draw_path_collection(
|
| 52 |
+
self,
|
| 53 |
+
gc: GraphicsContextBase,
|
| 54 |
+
master_transform: Transform,
|
| 55 |
+
paths: Sequence[Path],
|
| 56 |
+
all_transforms: Sequence[ArrayLike],
|
| 57 |
+
offsets: ArrayLike | Sequence[ArrayLike],
|
| 58 |
+
offset_trans: Transform,
|
| 59 |
+
facecolors: ColorType | Sequence[ColorType],
|
| 60 |
+
edgecolors: ColorType | Sequence[ColorType],
|
| 61 |
+
linewidths: float | Sequence[float],
|
| 62 |
+
linestyles: LineStyleType | Sequence[LineStyleType],
|
| 63 |
+
antialiaseds: bool | Sequence[bool],
|
| 64 |
+
urls: str | Sequence[str],
|
| 65 |
+
offset_position: Any,
|
| 66 |
+
) -> None: ...
|
| 67 |
+
def draw_quad_mesh(
|
| 68 |
+
self,
|
| 69 |
+
gc: GraphicsContextBase,
|
| 70 |
+
master_transform: Transform,
|
| 71 |
+
meshWidth,
|
| 72 |
+
meshHeight,
|
| 73 |
+
coordinates: ArrayLike,
|
| 74 |
+
offsets: ArrayLike | Sequence[ArrayLike],
|
| 75 |
+
offsetTrans: Transform,
|
| 76 |
+
facecolors: Sequence[ColorType],
|
| 77 |
+
antialiased: bool,
|
| 78 |
+
edgecolors: Sequence[ColorType] | ColorType | None,
|
| 79 |
+
) -> None: ...
|
| 80 |
+
def draw_gouraud_triangles(
|
| 81 |
+
self,
|
| 82 |
+
gc: GraphicsContextBase,
|
| 83 |
+
triangles_array: ArrayLike,
|
| 84 |
+
colors_array: ArrayLike,
|
| 85 |
+
transform: Transform,
|
| 86 |
+
) -> None: ...
|
| 87 |
+
def get_image_magnification(self) -> float: ...
|
| 88 |
+
def draw_image(
|
| 89 |
+
self,
|
| 90 |
+
gc: GraphicsContextBase,
|
| 91 |
+
x: float,
|
| 92 |
+
y: float,
|
| 93 |
+
im: ArrayLike,
|
| 94 |
+
transform: transforms.Affine2DBase | None = ...,
|
| 95 |
+
) -> None: ...
|
| 96 |
+
def option_image_nocomposite(self) -> bool: ...
|
| 97 |
+
def option_scale_image(self) -> bool: ...
|
| 98 |
+
def draw_tex(
|
| 99 |
+
self,
|
| 100 |
+
gc: GraphicsContextBase,
|
| 101 |
+
x: float,
|
| 102 |
+
y: float,
|
| 103 |
+
s: str,
|
| 104 |
+
prop: FontProperties,
|
| 105 |
+
angle: float,
|
| 106 |
+
*,
|
| 107 |
+
mtext: Text | None = ...
|
| 108 |
+
) -> None: ...
|
| 109 |
+
def draw_text(
|
| 110 |
+
self,
|
| 111 |
+
gc: GraphicsContextBase,
|
| 112 |
+
x: float,
|
| 113 |
+
y: float,
|
| 114 |
+
s: str,
|
| 115 |
+
prop: FontProperties,
|
| 116 |
+
angle: float,
|
| 117 |
+
ismath: bool | Literal["TeX"] = ...,
|
| 118 |
+
mtext: Text | None = ...,
|
| 119 |
+
) -> None: ...
|
| 120 |
+
def get_text_width_height_descent(
|
| 121 |
+
self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"]
|
| 122 |
+
) -> tuple[float, float, float]: ...
|
| 123 |
+
def flipy(self) -> bool: ...
|
| 124 |
+
def get_canvas_width_height(self) -> tuple[float, float]: ...
|
| 125 |
+
def get_texmanager(self) -> TexManager: ...
|
| 126 |
+
def new_gc(self) -> GraphicsContextBase: ...
|
| 127 |
+
def points_to_pixels(self, points: ArrayLike) -> ArrayLike: ...
|
| 128 |
+
def start_rasterizing(self) -> None: ...
|
| 129 |
+
def stop_rasterizing(self) -> None: ...
|
| 130 |
+
def start_filter(self) -> None: ...
|
| 131 |
+
def stop_filter(self, filter_func) -> None: ...
|
| 132 |
+
|
| 133 |
+
class GraphicsContextBase:
|
| 134 |
+
def __init__(self) -> None: ...
|
| 135 |
+
def copy_properties(self, gc: GraphicsContextBase) -> None: ...
|
| 136 |
+
def restore(self) -> None: ...
|
| 137 |
+
def get_alpha(self) -> float: ...
|
| 138 |
+
def get_antialiased(self) -> int: ...
|
| 139 |
+
def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
|
| 140 |
+
def get_clip_rectangle(self) -> Bbox | None: ...
|
| 141 |
+
def get_clip_path(
|
| 142 |
+
self,
|
| 143 |
+
) -> tuple[TransformedPath, Transform] | tuple[None, None]: ...
|
| 144 |
+
def get_dashes(self) -> tuple[float, ArrayLike | None]: ...
|
| 145 |
+
def get_forced_alpha(self) -> bool: ...
|
| 146 |
+
def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
|
| 147 |
+
def get_linewidth(self) -> float: ...
|
| 148 |
+
def get_rgb(self) -> tuple[float, float, float, float]: ...
|
| 149 |
+
def get_url(self) -> str | None: ...
|
| 150 |
+
def get_gid(self) -> int | None: ...
|
| 151 |
+
def get_snap(self) -> bool | None: ...
|
| 152 |
+
def set_alpha(self, alpha: float) -> None: ...
|
| 153 |
+
def set_antialiased(self, b: bool) -> None: ...
|
| 154 |
+
def set_capstyle(self, cs: CapStyleType) -> None: ...
|
| 155 |
+
def set_clip_rectangle(self, rectangle: Bbox | None) -> None: ...
|
| 156 |
+
def set_clip_path(self, path: TransformedPath | None) -> None: ...
|
| 157 |
+
def set_dashes(self, dash_offset: float, dash_list: ArrayLike | None) -> None: ...
|
| 158 |
+
def set_foreground(self, fg: ColorType, isRGBA: bool = ...) -> None: ...
|
| 159 |
+
def set_joinstyle(self, js: JoinStyleType) -> None: ...
|
| 160 |
+
def set_linewidth(self, w: float) -> None: ...
|
| 161 |
+
def set_url(self, url: str | None) -> None: ...
|
| 162 |
+
def set_gid(self, id: int | None) -> None: ...
|
| 163 |
+
def set_snap(self, snap: bool | None) -> None: ...
|
| 164 |
+
def set_hatch(self, hatch: str | None) -> None: ...
|
| 165 |
+
def get_hatch(self) -> str | None: ...
|
| 166 |
+
def get_hatch_path(self, density: float = ...) -> Path: ...
|
| 167 |
+
def get_hatch_color(self) -> ColorType: ...
|
| 168 |
+
def set_hatch_color(self, hatch_color: ColorType) -> None: ...
|
| 169 |
+
def get_hatch_linewidth(self) -> float: ...
|
| 170 |
+
def set_hatch_linewidth(self, hatch_linewidth: float) -> None: ...
|
| 171 |
+
def get_sketch_params(self) -> tuple[float, float, float] | None: ...
|
| 172 |
+
def set_sketch_params(
|
| 173 |
+
self,
|
| 174 |
+
scale: float | None = ...,
|
| 175 |
+
length: float | None = ...,
|
| 176 |
+
randomness: float | None = ...,
|
| 177 |
+
) -> None: ...
|
| 178 |
+
|
| 179 |
+
class TimerBase:
|
| 180 |
+
callbacks: list[tuple[Callable, tuple, dict[str, Any]]]
|
| 181 |
+
def __init__(
|
| 182 |
+
self,
|
| 183 |
+
interval: int | None = ...,
|
| 184 |
+
callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ...,
|
| 185 |
+
) -> None: ...
|
| 186 |
+
def __del__(self) -> None: ...
|
| 187 |
+
def start(self, interval: int | None = ...) -> None: ...
|
| 188 |
+
def stop(self) -> None: ...
|
| 189 |
+
@property
|
| 190 |
+
def interval(self) -> int: ...
|
| 191 |
+
@interval.setter
|
| 192 |
+
def interval(self, interval: int) -> None: ...
|
| 193 |
+
@property
|
| 194 |
+
def single_shot(self) -> bool: ...
|
| 195 |
+
@single_shot.setter
|
| 196 |
+
def single_shot(self, ss: bool) -> None: ...
|
| 197 |
+
def add_callback(self, func: Callable, *args, **kwargs) -> Callable: ...
|
| 198 |
+
def remove_callback(self, func: Callable, *args, **kwargs) -> None: ...
|
| 199 |
+
|
| 200 |
+
class Event:
|
| 201 |
+
name: str
|
| 202 |
+
canvas: FigureCanvasBase
|
| 203 |
+
guiEvent: Any
|
| 204 |
+
def __init__(
|
| 205 |
+
self, name: str, canvas: FigureCanvasBase, guiEvent: Any | None = ...
|
| 206 |
+
) -> None: ...
|
| 207 |
+
|
| 208 |
+
class DrawEvent(Event):
|
| 209 |
+
renderer: RendererBase
|
| 210 |
+
def __init__(
|
| 211 |
+
self, name: str, canvas: FigureCanvasBase, renderer: RendererBase
|
| 212 |
+
) -> None: ...
|
| 213 |
+
|
| 214 |
+
class ResizeEvent(Event):
|
| 215 |
+
width: int
|
| 216 |
+
height: int
|
| 217 |
+
def __init__(self, name: str, canvas: FigureCanvasBase) -> None: ...
|
| 218 |
+
|
| 219 |
+
class CloseEvent(Event): ...
|
| 220 |
+
|
| 221 |
+
class LocationEvent(Event):
|
| 222 |
+
x: int
|
| 223 |
+
y: int
|
| 224 |
+
inaxes: Axes | None
|
| 225 |
+
xdata: float | None
|
| 226 |
+
ydata: float | None
|
| 227 |
+
def __init__(
|
| 228 |
+
self,
|
| 229 |
+
name: str,
|
| 230 |
+
canvas: FigureCanvasBase,
|
| 231 |
+
x: int,
|
| 232 |
+
y: int,
|
| 233 |
+
guiEvent: Any | None = ...,
|
| 234 |
+
*,
|
| 235 |
+
modifiers: Iterable[str] | None = ...,
|
| 236 |
+
) -> None: ...
|
| 237 |
+
|
| 238 |
+
class MouseButton(IntEnum):
|
| 239 |
+
LEFT = 1
|
| 240 |
+
MIDDLE = 2
|
| 241 |
+
RIGHT = 3
|
| 242 |
+
BACK = 8
|
| 243 |
+
FORWARD = 9
|
| 244 |
+
|
| 245 |
+
class MouseEvent(LocationEvent):
|
| 246 |
+
button: MouseButton | Literal["up", "down"] | None
|
| 247 |
+
key: str | None
|
| 248 |
+
step: float
|
| 249 |
+
dblclick: bool
|
| 250 |
+
def __init__(
|
| 251 |
+
self,
|
| 252 |
+
name: str,
|
| 253 |
+
canvas: FigureCanvasBase,
|
| 254 |
+
x: int,
|
| 255 |
+
y: int,
|
| 256 |
+
button: MouseButton | Literal["up", "down"] | None = ...,
|
| 257 |
+
key: str | None = ...,
|
| 258 |
+
step: float = ...,
|
| 259 |
+
dblclick: bool = ...,
|
| 260 |
+
guiEvent: Any | None = ...,
|
| 261 |
+
*,
|
| 262 |
+
buttons: Iterable[MouseButton] | None = ...,
|
| 263 |
+
modifiers: Iterable[str] | None = ...,
|
| 264 |
+
) -> None: ...
|
| 265 |
+
|
| 266 |
+
class PickEvent(Event):
|
| 267 |
+
mouseevent: MouseEvent
|
| 268 |
+
artist: Artist
|
| 269 |
+
def __init__(
|
| 270 |
+
self,
|
| 271 |
+
name: str,
|
| 272 |
+
canvas: FigureCanvasBase,
|
| 273 |
+
mouseevent: MouseEvent,
|
| 274 |
+
artist: Artist,
|
| 275 |
+
guiEvent: Any | None = ...,
|
| 276 |
+
**kwargs
|
| 277 |
+
) -> None: ...
|
| 278 |
+
|
| 279 |
+
class KeyEvent(LocationEvent):
|
| 280 |
+
key: str | None
|
| 281 |
+
def __init__(
|
| 282 |
+
self,
|
| 283 |
+
name: str,
|
| 284 |
+
canvas: FigureCanvasBase,
|
| 285 |
+
key: str | None,
|
| 286 |
+
x: int = ...,
|
| 287 |
+
y: int = ...,
|
| 288 |
+
guiEvent: Any | None = ...,
|
| 289 |
+
) -> None: ...
|
| 290 |
+
|
| 291 |
+
class FigureCanvasBase:
|
| 292 |
+
required_interactive_framework: str | None
|
| 293 |
+
|
| 294 |
+
@_api.classproperty
|
| 295 |
+
def manager_class(cls) -> type[FigureManagerBase]: ...
|
| 296 |
+
events: list[str]
|
| 297 |
+
fixed_dpi: None | float
|
| 298 |
+
filetypes: dict[str, str]
|
| 299 |
+
|
| 300 |
+
@_api.classproperty
|
| 301 |
+
def supports_blit(cls) -> bool: ...
|
| 302 |
+
|
| 303 |
+
figure: Figure
|
| 304 |
+
manager: None | FigureManagerBase
|
| 305 |
+
widgetlock: widgets.LockDraw
|
| 306 |
+
mouse_grabber: None | Axes
|
| 307 |
+
toolbar: None | NavigationToolbar2
|
| 308 |
+
def __init__(self, figure: Figure | None = ...) -> None: ...
|
| 309 |
+
@property
|
| 310 |
+
def callbacks(self) -> cbook.CallbackRegistry: ...
|
| 311 |
+
@property
|
| 312 |
+
def button_pick_id(self) -> int: ...
|
| 313 |
+
@property
|
| 314 |
+
def scroll_pick_id(self) -> int: ...
|
| 315 |
+
@classmethod
|
| 316 |
+
def new_manager(cls, figure: Figure, num: int | str) -> FigureManagerBase: ...
|
| 317 |
+
def is_saving(self) -> bool: ...
|
| 318 |
+
def blit(self, bbox: BboxBase | None = ...) -> None: ...
|
| 319 |
+
def inaxes(self, xy: tuple[float, float]) -> Axes | None: ...
|
| 320 |
+
def grab_mouse(self, ax: Axes) -> None: ...
|
| 321 |
+
def release_mouse(self, ax: Axes) -> None: ...
|
| 322 |
+
def set_cursor(self, cursor: Cursors) -> None: ...
|
| 323 |
+
def draw(self, *args, **kwargs) -> None: ...
|
| 324 |
+
def draw_idle(self, *args, **kwargs) -> None: ...
|
| 325 |
+
@property
|
| 326 |
+
def device_pixel_ratio(self) -> float: ...
|
| 327 |
+
def get_width_height(self, *, physical: bool = ...) -> tuple[int, int]: ...
|
| 328 |
+
@classmethod
|
| 329 |
+
def get_supported_filetypes(cls) -> dict[str, str]: ...
|
| 330 |
+
@classmethod
|
| 331 |
+
def get_supported_filetypes_grouped(cls) -> dict[str, list[str]]: ...
|
| 332 |
+
def print_figure(
|
| 333 |
+
self,
|
| 334 |
+
filename: str | os.PathLike | IO,
|
| 335 |
+
dpi: float | None = ...,
|
| 336 |
+
facecolor: ColorType | Literal["auto"] | None = ...,
|
| 337 |
+
edgecolor: ColorType | Literal["auto"] | None = ...,
|
| 338 |
+
orientation: str = ...,
|
| 339 |
+
format: str | None = ...,
|
| 340 |
+
*,
|
| 341 |
+
bbox_inches: Literal["tight"] | Bbox | None = ...,
|
| 342 |
+
pad_inches: float | None = ...,
|
| 343 |
+
bbox_extra_artists: list[Artist] | None = ...,
|
| 344 |
+
backend: str | None = ...,
|
| 345 |
+
**kwargs
|
| 346 |
+
) -> Any: ...
|
| 347 |
+
@classmethod
|
| 348 |
+
def get_default_filetype(cls) -> str: ...
|
| 349 |
+
def get_default_filename(self) -> str: ...
|
| 350 |
+
_T = TypeVar("_T", bound=FigureCanvasBase)
|
| 351 |
+
def mpl_connect(self, s: str, func: Callable[[Event], Any]) -> int: ...
|
| 352 |
+
def mpl_disconnect(self, cid: int) -> None: ...
|
| 353 |
+
def new_timer(
|
| 354 |
+
self,
|
| 355 |
+
interval: int | None = ...,
|
| 356 |
+
callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ...,
|
| 357 |
+
) -> TimerBase: ...
|
| 358 |
+
def flush_events(self) -> None: ...
|
| 359 |
+
def start_event_loop(self, timeout: float = ...) -> None: ...
|
| 360 |
+
def stop_event_loop(self) -> None: ...
|
| 361 |
+
|
| 362 |
+
def key_press_handler(
|
| 363 |
+
event: KeyEvent,
|
| 364 |
+
canvas: FigureCanvasBase | None = ...,
|
| 365 |
+
toolbar: NavigationToolbar2 | None = ...,
|
| 366 |
+
) -> None: ...
|
| 367 |
+
def button_press_handler(
|
| 368 |
+
event: MouseEvent,
|
| 369 |
+
canvas: FigureCanvasBase | None = ...,
|
| 370 |
+
toolbar: NavigationToolbar2 | None = ...,
|
| 371 |
+
) -> None: ...
|
| 372 |
+
|
| 373 |
+
class NonGuiException(Exception): ...
|
| 374 |
+
|
| 375 |
+
class FigureManagerBase:
|
| 376 |
+
canvas: FigureCanvasBase
|
| 377 |
+
num: int | str
|
| 378 |
+
key_press_handler_id: int | None
|
| 379 |
+
button_press_handler_id: int | None
|
| 380 |
+
toolmanager: ToolManager | None
|
| 381 |
+
toolbar: NavigationToolbar2 | ToolContainerBase | None
|
| 382 |
+
def __init__(self, canvas: FigureCanvasBase, num: int | str) -> None: ...
|
| 383 |
+
@classmethod
|
| 384 |
+
def create_with_canvas(
|
| 385 |
+
cls, canvas_class: type[FigureCanvasBase], figure: Figure, num: int | str
|
| 386 |
+
) -> FigureManagerBase: ...
|
| 387 |
+
@classmethod
|
| 388 |
+
def start_main_loop(cls) -> None: ...
|
| 389 |
+
@classmethod
|
| 390 |
+
def pyplot_show(cls, *, block: bool | None = ...) -> None: ...
|
| 391 |
+
def show(self) -> None: ...
|
| 392 |
+
def destroy(self) -> None: ...
|
| 393 |
+
def full_screen_toggle(self) -> None: ...
|
| 394 |
+
def resize(self, w: int, h: int) -> None: ...
|
| 395 |
+
def get_window_title(self) -> str: ...
|
| 396 |
+
def set_window_title(self, title: str) -> None: ...
|
| 397 |
+
|
| 398 |
+
cursors = Cursors
|
| 399 |
+
|
| 400 |
+
class _Mode(str, Enum):
|
| 401 |
+
NONE = ""
|
| 402 |
+
PAN = "pan/zoom"
|
| 403 |
+
ZOOM = "zoom rect"
|
| 404 |
+
|
| 405 |
+
class NavigationToolbar2:
|
| 406 |
+
toolitems: tuple[tuple[str, ...] | tuple[None, ...], ...]
|
| 407 |
+
UNKNOWN_SAVED_STATUS: object
|
| 408 |
+
canvas: FigureCanvasBase
|
| 409 |
+
mode: _Mode
|
| 410 |
+
def __init__(self, canvas: FigureCanvasBase) -> None: ...
|
| 411 |
+
def set_message(self, s: str) -> None: ...
|
| 412 |
+
def draw_rubberband(
|
| 413 |
+
self, event: Event, x0: float, y0: float, x1: float, y1: float
|
| 414 |
+
) -> None: ...
|
| 415 |
+
def remove_rubberband(self) -> None: ...
|
| 416 |
+
def home(self, *args) -> None: ...
|
| 417 |
+
def back(self, *args) -> None: ...
|
| 418 |
+
def forward(self, *args) -> None: ...
|
| 419 |
+
def mouse_move(self, event: MouseEvent) -> None: ...
|
| 420 |
+
def pan(self, *args) -> None: ...
|
| 421 |
+
|
| 422 |
+
class _PanInfo(NamedTuple):
|
| 423 |
+
button: MouseButton
|
| 424 |
+
axes: list[Axes]
|
| 425 |
+
cid: int
|
| 426 |
+
def press_pan(self, event: Event) -> None: ...
|
| 427 |
+
def drag_pan(self, event: Event) -> None: ...
|
| 428 |
+
def release_pan(self, event: Event) -> None: ...
|
| 429 |
+
def zoom(self, *args) -> None: ...
|
| 430 |
+
|
| 431 |
+
class _ZoomInfo(NamedTuple):
|
| 432 |
+
direction: Literal["in", "out"]
|
| 433 |
+
start_xy: tuple[float, float]
|
| 434 |
+
axes: list[Axes]
|
| 435 |
+
cid: int
|
| 436 |
+
cbar: Colorbar
|
| 437 |
+
def press_zoom(self, event: Event) -> None: ...
|
| 438 |
+
def drag_zoom(self, event: Event) -> None: ...
|
| 439 |
+
def release_zoom(self, event: Event) -> None: ...
|
| 440 |
+
def push_current(self) -> None: ...
|
| 441 |
+
subplot_tool: widgets.SubplotTool
|
| 442 |
+
def configure_subplots(self, *args): ...
|
| 443 |
+
def save_figure(self, *args) -> str | None | object: ...
|
| 444 |
+
def update(self) -> None: ...
|
| 445 |
+
def set_history_buttons(self) -> None: ...
|
| 446 |
+
|
| 447 |
+
class ToolContainerBase:
|
| 448 |
+
toolmanager: ToolManager
|
| 449 |
+
def __init__(self, toolmanager: ToolManager) -> None: ...
|
| 450 |
+
def add_tool(self, tool: ToolBase, group: str, position: int = ...) -> None: ...
|
| 451 |
+
def trigger_tool(self, name: str) -> None: ...
|
| 452 |
+
def add_toolitem(
|
| 453 |
+
self,
|
| 454 |
+
name: str,
|
| 455 |
+
group: str,
|
| 456 |
+
position: int,
|
| 457 |
+
image: str,
|
| 458 |
+
description: str,
|
| 459 |
+
toggle: bool,
|
| 460 |
+
) -> None: ...
|
| 461 |
+
def toggle_toolitem(self, name: str, toggled: bool) -> None: ...
|
| 462 |
+
def remove_toolitem(self, name: str) -> None: ...
|
| 463 |
+
def set_message(self, s: str) -> None: ...
|
| 464 |
+
|
| 465 |
+
class _Backend:
|
| 466 |
+
backend_version: str
|
| 467 |
+
FigureCanvas: type[FigureCanvasBase] | None
|
| 468 |
+
FigureManager: type[FigureManagerBase]
|
| 469 |
+
mainloop: None | Callable[[], Any]
|
| 470 |
+
@classmethod
|
| 471 |
+
def new_figure_manager(cls, num: int | str, *args, **kwargs) -> FigureManagerBase: ...
|
| 472 |
+
@classmethod
|
| 473 |
+
def new_figure_manager_given_figure(cls, num: int | str, figure: Figure) -> FigureManagerBase: ...
|
| 474 |
+
@classmethod
|
| 475 |
+
def draw_if_interactive(cls) -> None: ...
|
| 476 |
+
@classmethod
|
| 477 |
+
def show(cls, *, block: bool | None = ...) -> None: ...
|
| 478 |
+
@staticmethod
|
| 479 |
+
def export(cls) -> type[_Backend]: ...
|
| 480 |
+
|
| 481 |
+
class ShowBase(_Backend):
|
| 482 |
+
def __call__(self, block: bool | None = ...) -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_managers.py
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from matplotlib import _api, backend_tools, cbook, widgets
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class ToolEvent:
|
| 5 |
+
"""Event for tool manipulation (add/remove)."""
|
| 6 |
+
def __init__(self, name, sender, tool, data=None):
|
| 7 |
+
self.name = name
|
| 8 |
+
self.sender = sender
|
| 9 |
+
self.tool = tool
|
| 10 |
+
self.data = data
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class ToolTriggerEvent(ToolEvent):
|
| 14 |
+
"""Event to inform that a tool has been triggered."""
|
| 15 |
+
def __init__(self, name, sender, tool, canvasevent=None, data=None):
|
| 16 |
+
super().__init__(name, sender, tool, data)
|
| 17 |
+
self.canvasevent = canvasevent
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class ToolManagerMessageEvent:
|
| 21 |
+
"""
|
| 22 |
+
Event carrying messages from toolmanager.
|
| 23 |
+
|
| 24 |
+
Messages usually get displayed to the user by the toolbar.
|
| 25 |
+
"""
|
| 26 |
+
def __init__(self, name, sender, message):
|
| 27 |
+
self.name = name
|
| 28 |
+
self.sender = sender
|
| 29 |
+
self.message = message
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class ToolManager:
|
| 33 |
+
"""
|
| 34 |
+
Manager for actions triggered by user interactions (key press, toolbar
|
| 35 |
+
clicks, ...) on a Figure.
|
| 36 |
+
|
| 37 |
+
Attributes
|
| 38 |
+
----------
|
| 39 |
+
figure : `.Figure`
|
| 40 |
+
keypresslock : `~matplotlib.widgets.LockDraw`
|
| 41 |
+
`.LockDraw` object to know if the `canvas` key_press_event is locked.
|
| 42 |
+
messagelock : `~matplotlib.widgets.LockDraw`
|
| 43 |
+
`.LockDraw` object to know if the message is available to write.
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
def __init__(self, figure=None):
|
| 47 |
+
|
| 48 |
+
self._key_press_handler_id = None
|
| 49 |
+
|
| 50 |
+
self._tools = {}
|
| 51 |
+
self._keys = {}
|
| 52 |
+
self._toggled = {}
|
| 53 |
+
self._callbacks = cbook.CallbackRegistry()
|
| 54 |
+
|
| 55 |
+
# to process keypress event
|
| 56 |
+
self.keypresslock = widgets.LockDraw()
|
| 57 |
+
self.messagelock = widgets.LockDraw()
|
| 58 |
+
|
| 59 |
+
self._figure = None
|
| 60 |
+
self.set_figure(figure)
|
| 61 |
+
|
| 62 |
+
@property
|
| 63 |
+
def canvas(self):
|
| 64 |
+
"""Canvas managed by FigureManager."""
|
| 65 |
+
if not self._figure:
|
| 66 |
+
return None
|
| 67 |
+
return self._figure.canvas
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def figure(self):
|
| 71 |
+
"""Figure that holds the canvas."""
|
| 72 |
+
return self._figure
|
| 73 |
+
|
| 74 |
+
@figure.setter
|
| 75 |
+
def figure(self, figure):
|
| 76 |
+
self.set_figure(figure)
|
| 77 |
+
|
| 78 |
+
def set_figure(self, figure, update_tools=True):
|
| 79 |
+
"""
|
| 80 |
+
Bind the given figure to the tools.
|
| 81 |
+
|
| 82 |
+
Parameters
|
| 83 |
+
----------
|
| 84 |
+
figure : `.Figure`
|
| 85 |
+
update_tools : bool, default: True
|
| 86 |
+
Force tools to update figure.
|
| 87 |
+
"""
|
| 88 |
+
if self._key_press_handler_id:
|
| 89 |
+
self.canvas.mpl_disconnect(self._key_press_handler_id)
|
| 90 |
+
self._figure = figure
|
| 91 |
+
if figure:
|
| 92 |
+
self._key_press_handler_id = self.canvas.mpl_connect(
|
| 93 |
+
'key_press_event', self._key_press)
|
| 94 |
+
if update_tools:
|
| 95 |
+
for tool in self._tools.values():
|
| 96 |
+
tool.figure = figure
|
| 97 |
+
|
| 98 |
+
def toolmanager_connect(self, s, func):
|
| 99 |
+
"""
|
| 100 |
+
Connect event with string *s* to *func*.
|
| 101 |
+
|
| 102 |
+
Parameters
|
| 103 |
+
----------
|
| 104 |
+
s : str
|
| 105 |
+
The name of the event. The following events are recognized:
|
| 106 |
+
|
| 107 |
+
- 'tool_message_event'
|
| 108 |
+
- 'tool_removed_event'
|
| 109 |
+
- 'tool_added_event'
|
| 110 |
+
|
| 111 |
+
For every tool added a new event is created
|
| 112 |
+
|
| 113 |
+
- 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool.
|
| 114 |
+
|
| 115 |
+
func : callable
|
| 116 |
+
Callback function for the toolmanager event with signature::
|
| 117 |
+
|
| 118 |
+
def func(event: ToolEvent) -> Any
|
| 119 |
+
|
| 120 |
+
Returns
|
| 121 |
+
-------
|
| 122 |
+
cid
|
| 123 |
+
The callback id for the connection. This can be used in
|
| 124 |
+
`.toolmanager_disconnect`.
|
| 125 |
+
"""
|
| 126 |
+
return self._callbacks.connect(s, func)
|
| 127 |
+
|
| 128 |
+
def toolmanager_disconnect(self, cid):
|
| 129 |
+
"""
|
| 130 |
+
Disconnect callback id *cid*.
|
| 131 |
+
|
| 132 |
+
Example usage::
|
| 133 |
+
|
| 134 |
+
cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress)
|
| 135 |
+
#...later
|
| 136 |
+
toolmanager.toolmanager_disconnect(cid)
|
| 137 |
+
"""
|
| 138 |
+
return self._callbacks.disconnect(cid)
|
| 139 |
+
|
| 140 |
+
def message_event(self, message, sender=None):
|
| 141 |
+
"""Emit a `ToolManagerMessageEvent`."""
|
| 142 |
+
if sender is None:
|
| 143 |
+
sender = self
|
| 144 |
+
|
| 145 |
+
s = 'tool_message_event'
|
| 146 |
+
event = ToolManagerMessageEvent(s, sender, message)
|
| 147 |
+
self._callbacks.process(s, event)
|
| 148 |
+
|
| 149 |
+
@property
|
| 150 |
+
def active_toggle(self):
|
| 151 |
+
"""Currently toggled tools."""
|
| 152 |
+
return self._toggled
|
| 153 |
+
|
| 154 |
+
def get_tool_keymap(self, name):
|
| 155 |
+
"""
|
| 156 |
+
Return the keymap associated with the specified tool.
|
| 157 |
+
|
| 158 |
+
Parameters
|
| 159 |
+
----------
|
| 160 |
+
name : str
|
| 161 |
+
Name of the Tool.
|
| 162 |
+
|
| 163 |
+
Returns
|
| 164 |
+
-------
|
| 165 |
+
list of str
|
| 166 |
+
List of keys associated with the tool.
|
| 167 |
+
"""
|
| 168 |
+
|
| 169 |
+
keys = [k for k, i in self._keys.items() if i == name]
|
| 170 |
+
return keys
|
| 171 |
+
|
| 172 |
+
def _remove_keys(self, name):
|
| 173 |
+
for k in self.get_tool_keymap(name):
|
| 174 |
+
del self._keys[k]
|
| 175 |
+
|
| 176 |
+
def update_keymap(self, name, key):
|
| 177 |
+
"""
|
| 178 |
+
Set the keymap to associate with the specified tool.
|
| 179 |
+
|
| 180 |
+
Parameters
|
| 181 |
+
----------
|
| 182 |
+
name : str
|
| 183 |
+
Name of the Tool.
|
| 184 |
+
key : str or list of str
|
| 185 |
+
Keys to associate with the tool.
|
| 186 |
+
"""
|
| 187 |
+
if name not in self._tools:
|
| 188 |
+
raise KeyError(f'{name!r} not in Tools')
|
| 189 |
+
self._remove_keys(name)
|
| 190 |
+
if isinstance(key, str):
|
| 191 |
+
key = [key]
|
| 192 |
+
for k in key:
|
| 193 |
+
if k in self._keys:
|
| 194 |
+
_api.warn_external(
|
| 195 |
+
f'Key {k} changed from {self._keys[k]} to {name}')
|
| 196 |
+
self._keys[k] = name
|
| 197 |
+
|
| 198 |
+
def remove_tool(self, name):
|
| 199 |
+
"""
|
| 200 |
+
Remove tool named *name*.
|
| 201 |
+
|
| 202 |
+
Parameters
|
| 203 |
+
----------
|
| 204 |
+
name : str
|
| 205 |
+
Name of the tool.
|
| 206 |
+
"""
|
| 207 |
+
tool = self.get_tool(name)
|
| 208 |
+
if getattr(tool, 'toggled', False): # If it's a toggled toggle tool, untoggle
|
| 209 |
+
self.trigger_tool(tool, 'toolmanager')
|
| 210 |
+
self._remove_keys(name)
|
| 211 |
+
event = ToolEvent('tool_removed_event', self, tool)
|
| 212 |
+
self._callbacks.process(event.name, event)
|
| 213 |
+
del self._tools[name]
|
| 214 |
+
|
| 215 |
+
def add_tool(self, name, tool, *args, **kwargs):
|
| 216 |
+
"""
|
| 217 |
+
Add *tool* to `ToolManager`.
|
| 218 |
+
|
| 219 |
+
If successful, adds a new event ``tool_trigger_{name}`` where
|
| 220 |
+
``{name}`` is the *name* of the tool; the event is fired every time the
|
| 221 |
+
tool is triggered.
|
| 222 |
+
|
| 223 |
+
Parameters
|
| 224 |
+
----------
|
| 225 |
+
name : str
|
| 226 |
+
Name of the tool, treated as the ID, has to be unique.
|
| 227 |
+
tool : type
|
| 228 |
+
Class of the tool to be added. A subclass will be used
|
| 229 |
+
instead if one was registered for the current canvas class.
|
| 230 |
+
*args, **kwargs
|
| 231 |
+
Passed to the *tool*'s constructor.
|
| 232 |
+
|
| 233 |
+
See Also
|
| 234 |
+
--------
|
| 235 |
+
matplotlib.backend_tools.ToolBase : The base class for tools.
|
| 236 |
+
"""
|
| 237 |
+
|
| 238 |
+
tool_cls = backend_tools._find_tool_class(type(self.canvas), tool)
|
| 239 |
+
if not tool_cls:
|
| 240 |
+
raise ValueError('Impossible to find class for %s' % str(tool))
|
| 241 |
+
|
| 242 |
+
if name in self._tools:
|
| 243 |
+
_api.warn_external('A "Tool class" with the same name already '
|
| 244 |
+
'exists, not added')
|
| 245 |
+
return self._tools[name]
|
| 246 |
+
|
| 247 |
+
tool_obj = tool_cls(self, name, *args, **kwargs)
|
| 248 |
+
self._tools[name] = tool_obj
|
| 249 |
+
|
| 250 |
+
if tool_obj.default_keymap is not None:
|
| 251 |
+
self.update_keymap(name, tool_obj.default_keymap)
|
| 252 |
+
|
| 253 |
+
# For toggle tools init the radio_group in self._toggled
|
| 254 |
+
if isinstance(tool_obj, backend_tools.ToolToggleBase):
|
| 255 |
+
# None group is not mutually exclusive, a set is used to keep track
|
| 256 |
+
# of all toggled tools in this group
|
| 257 |
+
if tool_obj.radio_group is None:
|
| 258 |
+
self._toggled.setdefault(None, set())
|
| 259 |
+
else:
|
| 260 |
+
self._toggled.setdefault(tool_obj.radio_group, None)
|
| 261 |
+
|
| 262 |
+
# If initially toggled
|
| 263 |
+
if tool_obj.toggled:
|
| 264 |
+
self._handle_toggle(tool_obj, None, None)
|
| 265 |
+
tool_obj.set_figure(self.figure)
|
| 266 |
+
|
| 267 |
+
event = ToolEvent('tool_added_event', self, tool_obj)
|
| 268 |
+
self._callbacks.process(event.name, event)
|
| 269 |
+
|
| 270 |
+
return tool_obj
|
| 271 |
+
|
| 272 |
+
def _handle_toggle(self, tool, canvasevent, data):
|
| 273 |
+
"""
|
| 274 |
+
Toggle tools, need to untoggle prior to using other Toggle tool.
|
| 275 |
+
Called from trigger_tool.
|
| 276 |
+
|
| 277 |
+
Parameters
|
| 278 |
+
----------
|
| 279 |
+
tool : `.ToolBase`
|
| 280 |
+
canvasevent : Event
|
| 281 |
+
Original Canvas event or None.
|
| 282 |
+
data : object
|
| 283 |
+
Extra data to pass to the tool when triggering.
|
| 284 |
+
"""
|
| 285 |
+
|
| 286 |
+
radio_group = tool.radio_group
|
| 287 |
+
# radio_group None is not mutually exclusive
|
| 288 |
+
# just keep track of toggled tools in this group
|
| 289 |
+
if radio_group is None:
|
| 290 |
+
if tool.name in self._toggled[None]:
|
| 291 |
+
self._toggled[None].remove(tool.name)
|
| 292 |
+
else:
|
| 293 |
+
self._toggled[None].add(tool.name)
|
| 294 |
+
return
|
| 295 |
+
|
| 296 |
+
# If the tool already has a toggled state, untoggle it
|
| 297 |
+
if self._toggled[radio_group] == tool.name:
|
| 298 |
+
toggled = None
|
| 299 |
+
# If no tool was toggled in the radio_group
|
| 300 |
+
# toggle it
|
| 301 |
+
elif self._toggled[radio_group] is None:
|
| 302 |
+
toggled = tool.name
|
| 303 |
+
# Other tool in the radio_group is toggled
|
| 304 |
+
else:
|
| 305 |
+
# Untoggle previously toggled tool
|
| 306 |
+
self.trigger_tool(self._toggled[radio_group],
|
| 307 |
+
self,
|
| 308 |
+
canvasevent,
|
| 309 |
+
data)
|
| 310 |
+
toggled = tool.name
|
| 311 |
+
|
| 312 |
+
# Keep track of the toggled tool in the radio_group
|
| 313 |
+
self._toggled[radio_group] = toggled
|
| 314 |
+
|
| 315 |
+
def trigger_tool(self, name, sender=None, canvasevent=None, data=None):
|
| 316 |
+
"""
|
| 317 |
+
Trigger a tool and emit the ``tool_trigger_{name}`` event.
|
| 318 |
+
|
| 319 |
+
Parameters
|
| 320 |
+
----------
|
| 321 |
+
name : str
|
| 322 |
+
Name of the tool.
|
| 323 |
+
sender : object
|
| 324 |
+
Object that wishes to trigger the tool.
|
| 325 |
+
canvasevent : Event
|
| 326 |
+
Original Canvas event or None.
|
| 327 |
+
data : object
|
| 328 |
+
Extra data to pass to the tool when triggering.
|
| 329 |
+
"""
|
| 330 |
+
tool = self.get_tool(name)
|
| 331 |
+
if tool is None:
|
| 332 |
+
return
|
| 333 |
+
|
| 334 |
+
if sender is None:
|
| 335 |
+
sender = self
|
| 336 |
+
|
| 337 |
+
if isinstance(tool, backend_tools.ToolToggleBase):
|
| 338 |
+
self._handle_toggle(tool, canvasevent, data)
|
| 339 |
+
|
| 340 |
+
tool.trigger(sender, canvasevent, data) # Actually trigger Tool.
|
| 341 |
+
|
| 342 |
+
s = 'tool_trigger_%s' % name
|
| 343 |
+
event = ToolTriggerEvent(s, sender, tool, canvasevent, data)
|
| 344 |
+
self._callbacks.process(s, event)
|
| 345 |
+
|
| 346 |
+
def _key_press(self, event):
|
| 347 |
+
if event.key is None or self.keypresslock.locked():
|
| 348 |
+
return
|
| 349 |
+
|
| 350 |
+
name = self._keys.get(event.key, None)
|
| 351 |
+
if name is None:
|
| 352 |
+
return
|
| 353 |
+
self.trigger_tool(name, canvasevent=event)
|
| 354 |
+
|
| 355 |
+
@property
|
| 356 |
+
def tools(self):
|
| 357 |
+
"""A dict mapping tool name -> controlled tool."""
|
| 358 |
+
return self._tools
|
| 359 |
+
|
| 360 |
+
def get_tool(self, name, warn=True):
|
| 361 |
+
"""
|
| 362 |
+
Return the tool object with the given name.
|
| 363 |
+
|
| 364 |
+
For convenience, this passes tool objects through.
|
| 365 |
+
|
| 366 |
+
Parameters
|
| 367 |
+
----------
|
| 368 |
+
name : str or `.ToolBase`
|
| 369 |
+
Name of the tool, or the tool itself.
|
| 370 |
+
warn : bool, default: True
|
| 371 |
+
Whether a warning should be emitted it no tool with the given name
|
| 372 |
+
exists.
|
| 373 |
+
|
| 374 |
+
Returns
|
| 375 |
+
-------
|
| 376 |
+
`.ToolBase` or None
|
| 377 |
+
The tool or None if no tool with the given name exists.
|
| 378 |
+
"""
|
| 379 |
+
if (isinstance(name, backend_tools.ToolBase)
|
| 380 |
+
and name.name in self._tools):
|
| 381 |
+
return name
|
| 382 |
+
if name not in self._tools:
|
| 383 |
+
if warn:
|
| 384 |
+
_api.warn_external(
|
| 385 |
+
f"ToolManager does not control tool {name!r}")
|
| 386 |
+
return None
|
| 387 |
+
return self._tools[name]
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_managers.pyi
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from matplotlib import backend_tools, widgets
|
| 2 |
+
from matplotlib.backend_bases import FigureCanvasBase
|
| 3 |
+
from matplotlib.figure import Figure
|
| 4 |
+
|
| 5 |
+
from collections.abc import Callable, Iterable
|
| 6 |
+
from typing import Any, TypeVar
|
| 7 |
+
|
| 8 |
+
class ToolEvent:
|
| 9 |
+
name: str
|
| 10 |
+
sender: Any
|
| 11 |
+
tool: backend_tools.ToolBase
|
| 12 |
+
data: Any
|
| 13 |
+
def __init__(self, name, sender, tool, data: Any | None = ...) -> None: ...
|
| 14 |
+
|
| 15 |
+
class ToolTriggerEvent(ToolEvent):
|
| 16 |
+
canvasevent: ToolEvent
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
name,
|
| 20 |
+
sender,
|
| 21 |
+
tool,
|
| 22 |
+
canvasevent: ToolEvent | None = ...,
|
| 23 |
+
data: Any | None = ...,
|
| 24 |
+
) -> None: ...
|
| 25 |
+
|
| 26 |
+
class ToolManagerMessageEvent:
|
| 27 |
+
name: str
|
| 28 |
+
sender: Any
|
| 29 |
+
message: str
|
| 30 |
+
def __init__(self, name: str, sender: Any, message: str) -> None: ...
|
| 31 |
+
|
| 32 |
+
class ToolManager:
|
| 33 |
+
keypresslock: widgets.LockDraw
|
| 34 |
+
messagelock: widgets.LockDraw
|
| 35 |
+
def __init__(self, figure: Figure | None = ...) -> None: ...
|
| 36 |
+
@property
|
| 37 |
+
def canvas(self) -> FigureCanvasBase | None: ...
|
| 38 |
+
@property
|
| 39 |
+
def figure(self) -> Figure | None: ...
|
| 40 |
+
@figure.setter
|
| 41 |
+
def figure(self, figure: Figure) -> None: ...
|
| 42 |
+
def set_figure(self, figure: Figure, update_tools: bool = ...) -> None: ...
|
| 43 |
+
def toolmanager_connect(self, s: str, func: Callable[[ToolEvent], Any]) -> int: ...
|
| 44 |
+
def toolmanager_disconnect(self, cid: int) -> None: ...
|
| 45 |
+
def message_event(self, message: str, sender: Any | None = ...) -> None: ...
|
| 46 |
+
@property
|
| 47 |
+
def active_toggle(self) -> dict[str | None, list[str] | str]: ...
|
| 48 |
+
def get_tool_keymap(self, name: str) -> list[str]: ...
|
| 49 |
+
def update_keymap(self, name: str, key: str | Iterable[str]) -> None: ...
|
| 50 |
+
def remove_tool(self, name: str) -> None: ...
|
| 51 |
+
_T = TypeVar("_T", bound=backend_tools.ToolBase)
|
| 52 |
+
def add_tool(self, name: str, tool: type[_T], *args, **kwargs) -> _T: ...
|
| 53 |
+
def trigger_tool(
|
| 54 |
+
self,
|
| 55 |
+
name: str | backend_tools.ToolBase,
|
| 56 |
+
sender: Any | None = ...,
|
| 57 |
+
canvasevent: ToolEvent | None = ...,
|
| 58 |
+
data: Any | None = ...,
|
| 59 |
+
) -> None: ...
|
| 60 |
+
@property
|
| 61 |
+
def tools(self) -> dict[str, backend_tools.ToolBase]: ...
|
| 62 |
+
def get_tool(
|
| 63 |
+
self, name: str | backend_tools.ToolBase, warn: bool = ...
|
| 64 |
+
) -> backend_tools.ToolBase | None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_tools.py
ADDED
|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|
+
|
| 8 |
+
:class:`ToolToggleBase`
|
| 9 |
+
Tool that has two states, only one Toggle tool can be
|
| 10 |
+
active at any given time for the same
|
| 11 |
+
`matplotlib.backend_managers.ToolManager`
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
import enum
|
| 15 |
+
import functools
|
| 16 |
+
import re
|
| 17 |
+
import time
|
| 18 |
+
from types import SimpleNamespace
|
| 19 |
+
import uuid
|
| 20 |
+
from weakref import WeakKeyDictionary
|
| 21 |
+
|
| 22 |
+
import numpy as np
|
| 23 |
+
|
| 24 |
+
import matplotlib as mpl
|
| 25 |
+
from matplotlib._pylab_helpers import Gcf
|
| 26 |
+
from matplotlib import _api, cbook
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class Cursors(enum.IntEnum): # Must subclass int for the macOS backend.
|
| 30 |
+
"""Backend-independent cursor types."""
|
| 31 |
+
POINTER = enum.auto()
|
| 32 |
+
HAND = enum.auto()
|
| 33 |
+
SELECT_REGION = enum.auto()
|
| 34 |
+
MOVE = enum.auto()
|
| 35 |
+
WAIT = enum.auto()
|
| 36 |
+
RESIZE_HORIZONTAL = enum.auto()
|
| 37 |
+
RESIZE_VERTICAL = enum.auto()
|
| 38 |
+
cursors = Cursors # Backcompat.
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# _tool_registry, _register_tool_class, and _find_tool_class implement a
|
| 42 |
+
# mechanism through which ToolManager.add_tool can determine whether a subclass
|
| 43 |
+
# of the requested tool class has been registered (either for the current
|
| 44 |
+
# canvas class or for a parent class), in which case that tool subclass will be
|
| 45 |
+
# instantiated instead. This is the mechanism used e.g. to allow different
|
| 46 |
+
# GUI backends to implement different specializations for ConfigureSubplots.
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
_tool_registry = set()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def _register_tool_class(canvas_cls, tool_cls=None):
|
| 53 |
+
"""Decorator registering *tool_cls* as a tool class for *canvas_cls*."""
|
| 54 |
+
if tool_cls is None:
|
| 55 |
+
return functools.partial(_register_tool_class, canvas_cls)
|
| 56 |
+
_tool_registry.add((canvas_cls, tool_cls))
|
| 57 |
+
return tool_cls
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def _find_tool_class(canvas_cls, tool_cls):
|
| 61 |
+
"""Find a subclass of *tool_cls* registered for *canvas_cls*."""
|
| 62 |
+
for canvas_parent in canvas_cls.__mro__:
|
| 63 |
+
for tool_child in _api.recursive_subclasses(tool_cls):
|
| 64 |
+
if (canvas_parent, tool_child) in _tool_registry:
|
| 65 |
+
return tool_child
|
| 66 |
+
return tool_cls
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# Views positions tool
|
| 70 |
+
_views_positions = 'viewpos'
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class ToolBase:
|
| 74 |
+
"""
|
| 75 |
+
Base tool class.
|
| 76 |
+
|
| 77 |
+
A base tool, only implements `trigger` method or no method at all.
|
| 78 |
+
The tool is instantiated by `matplotlib.backend_managers.ToolManager`.
|
| 79 |
+
"""
|
| 80 |
+
|
| 81 |
+
default_keymap = None
|
| 82 |
+
"""
|
| 83 |
+
Keymap to associate with this tool.
|
| 84 |
+
|
| 85 |
+
``list[str]``: List of keys that will trigger this tool when a keypress
|
| 86 |
+
event is emitted on ``self.figure.canvas``. Note that this attribute is
|
| 87 |
+
looked up on the instance, and can therefore be a property (this is used
|
| 88 |
+
e.g. by the built-in tools to load the rcParams at instantiation time).
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
description = None
|
| 92 |
+
"""
|
| 93 |
+
Description of the Tool.
|
| 94 |
+
|
| 95 |
+
`str`: Tooltip used if the Tool is included in a Toolbar.
|
| 96 |
+
"""
|
| 97 |
+
|
| 98 |
+
image = None
|
| 99 |
+
"""
|
| 100 |
+
Icon filename.
|
| 101 |
+
|
| 102 |
+
``str | None``: Filename of the Toolbar icon; either absolute, or relative to the
|
| 103 |
+
directory containing the Python source file where the ``Tool.image`` class attribute
|
| 104 |
+
is defined (in the latter case, this cannot be defined as an instance attribute).
|
| 105 |
+
In either case, the extension is optional; leaving it off lets individual backends
|
| 106 |
+
select the icon format they prefer. If None, the *name* is used as a label in the
|
| 107 |
+
toolbar button.
|
| 108 |
+
"""
|
| 109 |
+
|
| 110 |
+
def __init__(self, toolmanager, name):
|
| 111 |
+
self._name = name
|
| 112 |
+
self._toolmanager = toolmanager
|
| 113 |
+
self._figure = None
|
| 114 |
+
|
| 115 |
+
name = property(
|
| 116 |
+
lambda self: self._name,
|
| 117 |
+
doc="The tool id (str, must be unique among tools of a tool manager).")
|
| 118 |
+
toolmanager = property(
|
| 119 |
+
lambda self: self._toolmanager,
|
| 120 |
+
doc="The `.ToolManager` that controls this tool.")
|
| 121 |
+
canvas = property(
|
| 122 |
+
lambda self: self._figure.canvas if self._figure is not None else None,
|
| 123 |
+
doc="The canvas of the figure affected by this tool, or None.")
|
| 124 |
+
|
| 125 |
+
def set_figure(self, figure):
|
| 126 |
+
self._figure = figure
|
| 127 |
+
|
| 128 |
+
figure = property(
|
| 129 |
+
lambda self: self._figure,
|
| 130 |
+
# The setter must explicitly call self.set_figure so that subclasses can
|
| 131 |
+
# meaningfully override it.
|
| 132 |
+
lambda self, figure: self.set_figure(figure),
|
| 133 |
+
doc="The Figure affected by this tool, or None.")
|
| 134 |
+
|
| 135 |
+
def _make_classic_style_pseudo_toolbar(self):
|
| 136 |
+
"""
|
| 137 |
+
Return a placeholder object with a single `canvas` attribute.
|
| 138 |
+
|
| 139 |
+
This is useful to reuse the implementations of tools already provided
|
| 140 |
+
by the classic Toolbars.
|
| 141 |
+
"""
|
| 142 |
+
return SimpleNamespace(canvas=self.canvas)
|
| 143 |
+
|
| 144 |
+
def trigger(self, sender, event, data=None):
|
| 145 |
+
"""
|
| 146 |
+
Called when this tool gets used.
|
| 147 |
+
|
| 148 |
+
This method is called by `.ToolManager.trigger_tool`.
|
| 149 |
+
|
| 150 |
+
Parameters
|
| 151 |
+
----------
|
| 152 |
+
event : `.Event`
|
| 153 |
+
The canvas event that caused this tool to be called.
|
| 154 |
+
sender : object
|
| 155 |
+
Object that requested the tool to be triggered.
|
| 156 |
+
data : object
|
| 157 |
+
Extra data.
|
| 158 |
+
"""
|
| 159 |
+
pass
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class ToolToggleBase(ToolBase):
|
| 163 |
+
"""
|
| 164 |
+
Toggleable tool.
|
| 165 |
+
|
| 166 |
+
Every time it is triggered, it switches between enable and disable.
|
| 167 |
+
|
| 168 |
+
Parameters
|
| 169 |
+
----------
|
| 170 |
+
``*args``
|
| 171 |
+
Variable length argument to be used by the Tool.
|
| 172 |
+
``**kwargs``
|
| 173 |
+
`toggled` if present and True, sets the initial state of the Tool
|
| 174 |
+
Arbitrary keyword arguments to be consumed by the Tool
|
| 175 |
+
"""
|
| 176 |
+
|
| 177 |
+
radio_group = None
|
| 178 |
+
"""
|
| 179 |
+
Attribute to group 'radio' like tools (mutually exclusive).
|
| 180 |
+
|
| 181 |
+
`str` that identifies the group or **None** if not belonging to a group.
|
| 182 |
+
"""
|
| 183 |
+
|
| 184 |
+
cursor = None
|
| 185 |
+
"""Cursor to use when the tool is active."""
|
| 186 |
+
|
| 187 |
+
default_toggled = False
|
| 188 |
+
"""Default of toggled state."""
|
| 189 |
+
|
| 190 |
+
def __init__(self, *args, **kwargs):
|
| 191 |
+
self._toggled = kwargs.pop('toggled', self.default_toggled)
|
| 192 |
+
super().__init__(*args, **kwargs)
|
| 193 |
+
|
| 194 |
+
def trigger(self, sender, event, data=None):
|
| 195 |
+
"""Calls `enable` or `disable` based on `toggled` value."""
|
| 196 |
+
if self._toggled:
|
| 197 |
+
self.disable(event)
|
| 198 |
+
else:
|
| 199 |
+
self.enable(event)
|
| 200 |
+
self._toggled = not self._toggled
|
| 201 |
+
|
| 202 |
+
def enable(self, event=None):
|
| 203 |
+
"""
|
| 204 |
+
Enable the toggle tool.
|
| 205 |
+
|
| 206 |
+
`trigger` calls this method when `toggled` is False.
|
| 207 |
+
"""
|
| 208 |
+
pass
|
| 209 |
+
|
| 210 |
+
def disable(self, event=None):
|
| 211 |
+
"""
|
| 212 |
+
Disable the toggle tool.
|
| 213 |
+
|
| 214 |
+
`trigger` call this method when `toggled` is True.
|
| 215 |
+
|
| 216 |
+
This can happen in different circumstances.
|
| 217 |
+
|
| 218 |
+
* Click on the toolbar tool button.
|
| 219 |
+
* Call to `matplotlib.backend_managers.ToolManager.trigger_tool`.
|
| 220 |
+
* Another `ToolToggleBase` derived tool is triggered
|
| 221 |
+
(from the same `.ToolManager`).
|
| 222 |
+
"""
|
| 223 |
+
pass
|
| 224 |
+
|
| 225 |
+
@property
|
| 226 |
+
def toggled(self):
|
| 227 |
+
"""State of the toggled tool."""
|
| 228 |
+
return self._toggled
|
| 229 |
+
|
| 230 |
+
def set_figure(self, figure):
|
| 231 |
+
toggled = self.toggled
|
| 232 |
+
if toggled:
|
| 233 |
+
if self.figure:
|
| 234 |
+
self.trigger(self, None)
|
| 235 |
+
else:
|
| 236 |
+
# if no figure the internal state is not changed
|
| 237 |
+
# we change it here so next call to trigger will change it back
|
| 238 |
+
self._toggled = False
|
| 239 |
+
super().set_figure(figure)
|
| 240 |
+
if toggled:
|
| 241 |
+
if figure:
|
| 242 |
+
self.trigger(self, None)
|
| 243 |
+
else:
|
| 244 |
+
# if there is no figure, trigger won't change the internal
|
| 245 |
+
# state we change it back
|
| 246 |
+
self._toggled = True
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
class ToolSetCursor(ToolBase):
|
| 250 |
+
"""
|
| 251 |
+
Change to the current cursor while inaxes.
|
| 252 |
+
|
| 253 |
+
This tool, keeps track of all `ToolToggleBase` derived tools, and updates
|
| 254 |
+
the cursor when a tool gets triggered.
|
| 255 |
+
"""
|
| 256 |
+
def __init__(self, *args, **kwargs):
|
| 257 |
+
super().__init__(*args, **kwargs)
|
| 258 |
+
self._id_drag = None
|
| 259 |
+
self._current_tool = None
|
| 260 |
+
self._default_cursor = cursors.POINTER
|
| 261 |
+
self._last_cursor = self._default_cursor
|
| 262 |
+
self.toolmanager.toolmanager_connect('tool_added_event',
|
| 263 |
+
self._add_tool_cbk)
|
| 264 |
+
for tool in self.toolmanager.tools.values(): # process current tools
|
| 265 |
+
self._add_tool_cbk(mpl.backend_managers.ToolEvent(
|
| 266 |
+
'tool_added_event', self.toolmanager, tool))
|
| 267 |
+
|
| 268 |
+
def set_figure(self, figure):
|
| 269 |
+
if self._id_drag:
|
| 270 |
+
self.canvas.mpl_disconnect(self._id_drag)
|
| 271 |
+
super().set_figure(figure)
|
| 272 |
+
if figure:
|
| 273 |
+
self._id_drag = self.canvas.mpl_connect(
|
| 274 |
+
'motion_notify_event', self._set_cursor_cbk)
|
| 275 |
+
|
| 276 |
+
def _add_tool_cbk(self, event):
|
| 277 |
+
"""Process every newly added tool."""
|
| 278 |
+
if getattr(event.tool, 'cursor', None) is not None:
|
| 279 |
+
self.toolmanager.toolmanager_connect(
|
| 280 |
+
f'tool_trigger_{event.tool.name}', self._tool_trigger_cbk)
|
| 281 |
+
|
| 282 |
+
def _tool_trigger_cbk(self, event):
|
| 283 |
+
self._current_tool = event.tool if event.tool.toggled else None
|
| 284 |
+
self._set_cursor_cbk(event.canvasevent)
|
| 285 |
+
|
| 286 |
+
def _set_cursor_cbk(self, event):
|
| 287 |
+
if not event or not self.canvas:
|
| 288 |
+
return
|
| 289 |
+
if (self._current_tool and getattr(event, "inaxes", None)
|
| 290 |
+
and event.inaxes.get_navigate()):
|
| 291 |
+
if self._last_cursor != self._current_tool.cursor:
|
| 292 |
+
self.canvas.set_cursor(self._current_tool.cursor)
|
| 293 |
+
self._last_cursor = self._current_tool.cursor
|
| 294 |
+
elif self._last_cursor != self._default_cursor:
|
| 295 |
+
self.canvas.set_cursor(self._default_cursor)
|
| 296 |
+
self._last_cursor = self._default_cursor
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
class ToolCursorPosition(ToolBase):
|
| 300 |
+
"""
|
| 301 |
+
Send message with the current pointer position.
|
| 302 |
+
|
| 303 |
+
This tool runs in the background reporting the position of the cursor.
|
| 304 |
+
"""
|
| 305 |
+
def __init__(self, *args, **kwargs):
|
| 306 |
+
self._id_drag = None
|
| 307 |
+
super().__init__(*args, **kwargs)
|
| 308 |
+
|
| 309 |
+
def set_figure(self, figure):
|
| 310 |
+
if self._id_drag:
|
| 311 |
+
self.canvas.mpl_disconnect(self._id_drag)
|
| 312 |
+
super().set_figure(figure)
|
| 313 |
+
if figure:
|
| 314 |
+
self._id_drag = self.canvas.mpl_connect(
|
| 315 |
+
'motion_notify_event', self.send_message)
|
| 316 |
+
|
| 317 |
+
def send_message(self, event):
|
| 318 |
+
"""Call `matplotlib.backend_managers.ToolManager.message_event`."""
|
| 319 |
+
if self.toolmanager.messagelock.locked():
|
| 320 |
+
return
|
| 321 |
+
|
| 322 |
+
from matplotlib.backend_bases import NavigationToolbar2
|
| 323 |
+
message = NavigationToolbar2._mouse_event_to_message(event)
|
| 324 |
+
self.toolmanager.message_event(message, self)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
class RubberbandBase(ToolBase):
|
| 328 |
+
"""Draw and remove a rubberband."""
|
| 329 |
+
def trigger(self, sender, event, data=None):
|
| 330 |
+
"""Call `draw_rubberband` or `remove_rubberband` based on data."""
|
| 331 |
+
if not self.figure.canvas.widgetlock.available(sender):
|
| 332 |
+
return
|
| 333 |
+
if data is not None:
|
| 334 |
+
self.draw_rubberband(*data)
|
| 335 |
+
else:
|
| 336 |
+
self.remove_rubberband()
|
| 337 |
+
|
| 338 |
+
def draw_rubberband(self, *data):
|
| 339 |
+
"""
|
| 340 |
+
Draw rubberband.
|
| 341 |
+
|
| 342 |
+
This method must get implemented per backend.
|
| 343 |
+
"""
|
| 344 |
+
raise NotImplementedError
|
| 345 |
+
|
| 346 |
+
def remove_rubberband(self):
|
| 347 |
+
"""
|
| 348 |
+
Remove rubberband.
|
| 349 |
+
|
| 350 |
+
This method should get implemented per backend.
|
| 351 |
+
"""
|
| 352 |
+
pass
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class ToolQuit(ToolBase):
|
| 356 |
+
"""Tool to call the figure manager destroy method."""
|
| 357 |
+
|
| 358 |
+
description = 'Quit the figure'
|
| 359 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.quit'])
|
| 360 |
+
|
| 361 |
+
def trigger(self, sender, event, data=None):
|
| 362 |
+
Gcf.destroy_fig(self.figure)
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
class ToolQuitAll(ToolBase):
|
| 366 |
+
"""Tool to call the figure manager destroy method."""
|
| 367 |
+
|
| 368 |
+
description = 'Quit all figures'
|
| 369 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.quit_all'])
|
| 370 |
+
|
| 371 |
+
def trigger(self, sender, event, data=None):
|
| 372 |
+
Gcf.destroy_all()
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
class ToolGrid(ToolBase):
|
| 376 |
+
"""Tool to toggle the major grids of the figure."""
|
| 377 |
+
|
| 378 |
+
description = 'Toggle major grids'
|
| 379 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.grid'])
|
| 380 |
+
|
| 381 |
+
def trigger(self, sender, event, data=None):
|
| 382 |
+
sentinel = str(uuid.uuid4())
|
| 383 |
+
# Trigger grid switching by temporarily setting :rc:`keymap.grid`
|
| 384 |
+
# to a unique key and sending an appropriate event.
|
| 385 |
+
with (cbook._setattr_cm(event, key=sentinel),
|
| 386 |
+
mpl.rc_context({'keymap.grid': sentinel})):
|
| 387 |
+
mpl.backend_bases.key_press_handler(event, self.figure.canvas)
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
class ToolMinorGrid(ToolBase):
|
| 391 |
+
"""Tool to toggle the major and minor grids of the figure."""
|
| 392 |
+
|
| 393 |
+
description = 'Toggle major and minor grids'
|
| 394 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.grid_minor'])
|
| 395 |
+
|
| 396 |
+
def trigger(self, sender, event, data=None):
|
| 397 |
+
sentinel = str(uuid.uuid4())
|
| 398 |
+
# Trigger grid switching by temporarily setting :rc:`keymap.grid_minor`
|
| 399 |
+
# to a unique key and sending an appropriate event.
|
| 400 |
+
with (cbook._setattr_cm(event, key=sentinel),
|
| 401 |
+
mpl.rc_context({'keymap.grid_minor': sentinel})):
|
| 402 |
+
mpl.backend_bases.key_press_handler(event, self.figure.canvas)
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
class ToolFullScreen(ToolBase):
|
| 406 |
+
"""Tool to toggle full screen."""
|
| 407 |
+
|
| 408 |
+
description = 'Toggle fullscreen mode'
|
| 409 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.fullscreen'])
|
| 410 |
+
|
| 411 |
+
def trigger(self, sender, event, data=None):
|
| 412 |
+
self.figure.canvas.manager.full_screen_toggle()
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
class AxisScaleBase(ToolToggleBase):
|
| 416 |
+
"""Base Tool to toggle between linear and logarithmic."""
|
| 417 |
+
|
| 418 |
+
def trigger(self, sender, event, data=None):
|
| 419 |
+
if event.inaxes is None:
|
| 420 |
+
return
|
| 421 |
+
super().trigger(sender, event, data)
|
| 422 |
+
|
| 423 |
+
def enable(self, event=None):
|
| 424 |
+
self.set_scale(event.inaxes, 'log')
|
| 425 |
+
self.figure.canvas.draw_idle()
|
| 426 |
+
|
| 427 |
+
def disable(self, event=None):
|
| 428 |
+
self.set_scale(event.inaxes, 'linear')
|
| 429 |
+
self.figure.canvas.draw_idle()
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
class ToolYScale(AxisScaleBase):
|
| 433 |
+
"""Tool to toggle between linear and logarithmic scales on the Y axis."""
|
| 434 |
+
|
| 435 |
+
description = 'Toggle scale Y axis'
|
| 436 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.yscale'])
|
| 437 |
+
|
| 438 |
+
def set_scale(self, ax, scale):
|
| 439 |
+
ax.set_yscale(scale)
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
class ToolXScale(AxisScaleBase):
|
| 443 |
+
"""Tool to toggle between linear and logarithmic scales on the X axis."""
|
| 444 |
+
|
| 445 |
+
description = 'Toggle scale X axis'
|
| 446 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.xscale'])
|
| 447 |
+
|
| 448 |
+
def set_scale(self, ax, scale):
|
| 449 |
+
ax.set_xscale(scale)
|
| 450 |
+
|
| 451 |
+
|
| 452 |
+
class ToolViewsPositions(ToolBase):
|
| 453 |
+
"""
|
| 454 |
+
Auxiliary Tool to handle changes in views and positions.
|
| 455 |
+
|
| 456 |
+
Runs in the background and should get used by all the tools that
|
| 457 |
+
need to access the figure's history of views and positions, e.g.
|
| 458 |
+
|
| 459 |
+
* `ToolZoom`
|
| 460 |
+
* `ToolPan`
|
| 461 |
+
* `ToolHome`
|
| 462 |
+
* `ToolBack`
|
| 463 |
+
* `ToolForward`
|
| 464 |
+
"""
|
| 465 |
+
|
| 466 |
+
def __init__(self, *args, **kwargs):
|
| 467 |
+
self.views = WeakKeyDictionary()
|
| 468 |
+
self.positions = WeakKeyDictionary()
|
| 469 |
+
self.home_views = WeakKeyDictionary()
|
| 470 |
+
super().__init__(*args, **kwargs)
|
| 471 |
+
|
| 472 |
+
def add_figure(self, figure):
|
| 473 |
+
"""Add the current figure to the stack of views and positions."""
|
| 474 |
+
|
| 475 |
+
if figure not in self.views:
|
| 476 |
+
self.views[figure] = cbook._Stack()
|
| 477 |
+
self.positions[figure] = cbook._Stack()
|
| 478 |
+
self.home_views[figure] = WeakKeyDictionary()
|
| 479 |
+
# Define Home
|
| 480 |
+
self.push_current(figure)
|
| 481 |
+
# Make sure we add a home view for new Axes as they're added
|
| 482 |
+
figure.add_axobserver(lambda fig: self.update_home_views(fig))
|
| 483 |
+
|
| 484 |
+
def clear(self, figure):
|
| 485 |
+
"""Reset the Axes stack."""
|
| 486 |
+
if figure in self.views:
|
| 487 |
+
self.views[figure].clear()
|
| 488 |
+
self.positions[figure].clear()
|
| 489 |
+
self.home_views[figure].clear()
|
| 490 |
+
self.update_home_views()
|
| 491 |
+
|
| 492 |
+
def update_view(self):
|
| 493 |
+
"""
|
| 494 |
+
Update the view limits and position for each Axes from the current
|
| 495 |
+
stack position. If any Axes are present in the figure that aren't in
|
| 496 |
+
the current stack position, use the home view limits for those Axes and
|
| 497 |
+
don't update *any* positions.
|
| 498 |
+
"""
|
| 499 |
+
|
| 500 |
+
views = self.views[self.figure]()
|
| 501 |
+
if views is None:
|
| 502 |
+
return
|
| 503 |
+
pos = self.positions[self.figure]()
|
| 504 |
+
if pos is None:
|
| 505 |
+
return
|
| 506 |
+
home_views = self.home_views[self.figure]
|
| 507 |
+
all_axes = self.figure.get_axes()
|
| 508 |
+
for a in all_axes:
|
| 509 |
+
if a in views:
|
| 510 |
+
cur_view = views[a]
|
| 511 |
+
else:
|
| 512 |
+
cur_view = home_views[a]
|
| 513 |
+
a._set_view(cur_view)
|
| 514 |
+
|
| 515 |
+
if set(all_axes).issubset(pos):
|
| 516 |
+
for a in all_axes:
|
| 517 |
+
# Restore both the original and modified positions
|
| 518 |
+
a._set_position(pos[a][0], 'original')
|
| 519 |
+
a._set_position(pos[a][1], 'active')
|
| 520 |
+
|
| 521 |
+
self.figure.canvas.draw_idle()
|
| 522 |
+
|
| 523 |
+
def push_current(self, figure=None):
|
| 524 |
+
"""
|
| 525 |
+
Push the current view limits and position onto their respective stacks.
|
| 526 |
+
"""
|
| 527 |
+
if not figure:
|
| 528 |
+
figure = self.figure
|
| 529 |
+
views = WeakKeyDictionary()
|
| 530 |
+
pos = WeakKeyDictionary()
|
| 531 |
+
for a in figure.get_axes():
|
| 532 |
+
views[a] = a._get_view()
|
| 533 |
+
pos[a] = self._axes_pos(a)
|
| 534 |
+
self.views[figure].push(views)
|
| 535 |
+
self.positions[figure].push(pos)
|
| 536 |
+
|
| 537 |
+
def _axes_pos(self, ax):
|
| 538 |
+
"""
|
| 539 |
+
Return the original and modified positions for the specified Axes.
|
| 540 |
+
|
| 541 |
+
Parameters
|
| 542 |
+
----------
|
| 543 |
+
ax : matplotlib.axes.Axes
|
| 544 |
+
The `.Axes` to get the positions for.
|
| 545 |
+
|
| 546 |
+
Returns
|
| 547 |
+
-------
|
| 548 |
+
original_position, modified_position
|
| 549 |
+
A tuple of the original and modified positions.
|
| 550 |
+
"""
|
| 551 |
+
|
| 552 |
+
return (ax.get_position(True).frozen(),
|
| 553 |
+
ax.get_position().frozen())
|
| 554 |
+
|
| 555 |
+
def update_home_views(self, figure=None):
|
| 556 |
+
"""
|
| 557 |
+
Make sure that ``self.home_views`` has an entry for all Axes present
|
| 558 |
+
in the figure.
|
| 559 |
+
"""
|
| 560 |
+
|
| 561 |
+
if not figure:
|
| 562 |
+
figure = self.figure
|
| 563 |
+
for a in figure.get_axes():
|
| 564 |
+
if a not in self.home_views[figure]:
|
| 565 |
+
self.home_views[figure][a] = a._get_view()
|
| 566 |
+
|
| 567 |
+
def home(self):
|
| 568 |
+
"""Recall the first view and position from the stack."""
|
| 569 |
+
self.views[self.figure].home()
|
| 570 |
+
self.positions[self.figure].home()
|
| 571 |
+
|
| 572 |
+
def back(self):
|
| 573 |
+
"""Back one step in the stack of views and positions."""
|
| 574 |
+
self.views[self.figure].back()
|
| 575 |
+
self.positions[self.figure].back()
|
| 576 |
+
|
| 577 |
+
def forward(self):
|
| 578 |
+
"""Forward one step in the stack of views and positions."""
|
| 579 |
+
self.views[self.figure].forward()
|
| 580 |
+
self.positions[self.figure].forward()
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
class ViewsPositionsBase(ToolBase):
|
| 584 |
+
"""Base class for `ToolHome`, `ToolBack` and `ToolForward`."""
|
| 585 |
+
|
| 586 |
+
_on_trigger = None
|
| 587 |
+
|
| 588 |
+
def trigger(self, sender, event, data=None):
|
| 589 |
+
self.toolmanager.get_tool(_views_positions).add_figure(self.figure)
|
| 590 |
+
getattr(self.toolmanager.get_tool(_views_positions),
|
| 591 |
+
self._on_trigger)()
|
| 592 |
+
self.toolmanager.get_tool(_views_positions).update_view()
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
class ToolHome(ViewsPositionsBase):
|
| 596 |
+
"""Restore the original view limits."""
|
| 597 |
+
|
| 598 |
+
description = 'Reset original view'
|
| 599 |
+
image = 'mpl-data/images/home'
|
| 600 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.home'])
|
| 601 |
+
_on_trigger = 'home'
|
| 602 |
+
|
| 603 |
+
|
| 604 |
+
class ToolBack(ViewsPositionsBase):
|
| 605 |
+
"""Move back up the view limits stack."""
|
| 606 |
+
|
| 607 |
+
description = 'Back to previous view'
|
| 608 |
+
image = 'mpl-data/images/back'
|
| 609 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.back'])
|
| 610 |
+
_on_trigger = 'back'
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
class ToolForward(ViewsPositionsBase):
|
| 614 |
+
"""Move forward in the view lim stack."""
|
| 615 |
+
|
| 616 |
+
description = 'Forward to next view'
|
| 617 |
+
image = 'mpl-data/images/forward'
|
| 618 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.forward'])
|
| 619 |
+
_on_trigger = 'forward'
|
| 620 |
+
|
| 621 |
+
|
| 622 |
+
class ConfigureSubplotsBase(ToolBase):
|
| 623 |
+
"""Base tool for the configuration of subplots."""
|
| 624 |
+
|
| 625 |
+
description = 'Configure subplots'
|
| 626 |
+
image = 'mpl-data/images/subplots'
|
| 627 |
+
|
| 628 |
+
|
| 629 |
+
class SaveFigureBase(ToolBase):
|
| 630 |
+
"""Base tool for figure saving."""
|
| 631 |
+
|
| 632 |
+
description = 'Save the figure'
|
| 633 |
+
image = 'mpl-data/images/filesave'
|
| 634 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.save'])
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
class ZoomPanBase(ToolToggleBase):
|
| 638 |
+
"""Base class for `ToolZoom` and `ToolPan`."""
|
| 639 |
+
def __init__(self, *args):
|
| 640 |
+
super().__init__(*args)
|
| 641 |
+
self._button_pressed = None
|
| 642 |
+
self._xypress = None
|
| 643 |
+
self._idPress = None
|
| 644 |
+
self._idRelease = None
|
| 645 |
+
self._idScroll = None
|
| 646 |
+
self.base_scale = 2.
|
| 647 |
+
self.scrollthresh = .5 # .5 second scroll threshold
|
| 648 |
+
self.lastscroll = time.time()-self.scrollthresh
|
| 649 |
+
|
| 650 |
+
def enable(self, event=None):
|
| 651 |
+
"""Connect press/release events and lock the canvas."""
|
| 652 |
+
self.figure.canvas.widgetlock(self)
|
| 653 |
+
self._idPress = self.figure.canvas.mpl_connect(
|
| 654 |
+
'button_press_event', self._press)
|
| 655 |
+
self._idRelease = self.figure.canvas.mpl_connect(
|
| 656 |
+
'button_release_event', self._release)
|
| 657 |
+
self._idScroll = self.figure.canvas.mpl_connect(
|
| 658 |
+
'scroll_event', self.scroll_zoom)
|
| 659 |
+
|
| 660 |
+
def disable(self, event=None):
|
| 661 |
+
"""Release the canvas and disconnect press/release events."""
|
| 662 |
+
self._cancel_action()
|
| 663 |
+
self.figure.canvas.widgetlock.release(self)
|
| 664 |
+
self.figure.canvas.mpl_disconnect(self._idPress)
|
| 665 |
+
self.figure.canvas.mpl_disconnect(self._idRelease)
|
| 666 |
+
self.figure.canvas.mpl_disconnect(self._idScroll)
|
| 667 |
+
|
| 668 |
+
def trigger(self, sender, event, data=None):
|
| 669 |
+
self.toolmanager.get_tool(_views_positions).add_figure(self.figure)
|
| 670 |
+
super().trigger(sender, event, data)
|
| 671 |
+
new_navigate_mode = self.name.upper() if self.toggled else None
|
| 672 |
+
for ax in self.figure.axes:
|
| 673 |
+
ax.set_navigate_mode(new_navigate_mode)
|
| 674 |
+
|
| 675 |
+
def scroll_zoom(self, event):
|
| 676 |
+
# https://gist.github.com/tacaswell/3144287
|
| 677 |
+
if event.inaxes is None:
|
| 678 |
+
return
|
| 679 |
+
|
| 680 |
+
if event.button == 'up':
|
| 681 |
+
# deal with zoom in
|
| 682 |
+
scl = self.base_scale
|
| 683 |
+
elif event.button == 'down':
|
| 684 |
+
# deal with zoom out
|
| 685 |
+
scl = 1/self.base_scale
|
| 686 |
+
else:
|
| 687 |
+
# deal with something that should never happen
|
| 688 |
+
scl = 1
|
| 689 |
+
|
| 690 |
+
ax = event.inaxes
|
| 691 |
+
ax._set_view_from_bbox([event.x, event.y, scl])
|
| 692 |
+
|
| 693 |
+
# If last scroll was done within the timing threshold, delete the
|
| 694 |
+
# previous view
|
| 695 |
+
if (time.time()-self.lastscroll) < self.scrollthresh:
|
| 696 |
+
self.toolmanager.get_tool(_views_positions).back()
|
| 697 |
+
|
| 698 |
+
self.figure.canvas.draw_idle() # force re-draw
|
| 699 |
+
|
| 700 |
+
self.lastscroll = time.time()
|
| 701 |
+
self.toolmanager.get_tool(_views_positions).push_current()
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
class ToolZoom(ZoomPanBase):
|
| 705 |
+
"""A Tool for zooming using a rectangle selector."""
|
| 706 |
+
|
| 707 |
+
description = 'Zoom to rectangle'
|
| 708 |
+
image = 'mpl-data/images/zoom_to_rect'
|
| 709 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.zoom'])
|
| 710 |
+
cursor = cursors.SELECT_REGION
|
| 711 |
+
radio_group = 'default'
|
| 712 |
+
|
| 713 |
+
def __init__(self, *args):
|
| 714 |
+
super().__init__(*args)
|
| 715 |
+
self._ids_zoom = []
|
| 716 |
+
|
| 717 |
+
def _cancel_action(self):
|
| 718 |
+
for zoom_id in self._ids_zoom:
|
| 719 |
+
self.figure.canvas.mpl_disconnect(zoom_id)
|
| 720 |
+
self.toolmanager.trigger_tool('rubberband', self)
|
| 721 |
+
self.figure.canvas.draw_idle()
|
| 722 |
+
self._xypress = None
|
| 723 |
+
self._button_pressed = None
|
| 724 |
+
self._ids_zoom = []
|
| 725 |
+
return
|
| 726 |
+
|
| 727 |
+
def _press(self, event):
|
| 728 |
+
"""Callback for mouse button presses in zoom-to-rectangle mode."""
|
| 729 |
+
|
| 730 |
+
# If we're already in the middle of a zoom, pressing another
|
| 731 |
+
# button works to "cancel"
|
| 732 |
+
if self._ids_zoom:
|
| 733 |
+
self._cancel_action()
|
| 734 |
+
|
| 735 |
+
if event.button == 1:
|
| 736 |
+
self._button_pressed = 1
|
| 737 |
+
elif event.button == 3:
|
| 738 |
+
self._button_pressed = 3
|
| 739 |
+
else:
|
| 740 |
+
self._cancel_action()
|
| 741 |
+
return
|
| 742 |
+
|
| 743 |
+
x, y = event.x, event.y
|
| 744 |
+
|
| 745 |
+
self._xypress = []
|
| 746 |
+
for i, a in enumerate(self.figure.get_axes()):
|
| 747 |
+
if (x is not None and y is not None and a.in_axes(event) and
|
| 748 |
+
a.get_navigate() and a.can_zoom()):
|
| 749 |
+
self._xypress.append((x, y, a, i, a._get_view()))
|
| 750 |
+
|
| 751 |
+
id1 = self.figure.canvas.mpl_connect(
|
| 752 |
+
'motion_notify_event', self._mouse_move)
|
| 753 |
+
id2 = self.figure.canvas.mpl_connect(
|
| 754 |
+
'key_press_event', self._switch_on_zoom_mode)
|
| 755 |
+
id3 = self.figure.canvas.mpl_connect(
|
| 756 |
+
'key_release_event', self._switch_off_zoom_mode)
|
| 757 |
+
|
| 758 |
+
self._ids_zoom = id1, id2, id3
|
| 759 |
+
self._zoom_mode = event.key
|
| 760 |
+
|
| 761 |
+
def _switch_on_zoom_mode(self, event):
|
| 762 |
+
self._zoom_mode = event.key
|
| 763 |
+
self._mouse_move(event)
|
| 764 |
+
|
| 765 |
+
def _switch_off_zoom_mode(self, event):
|
| 766 |
+
self._zoom_mode = None
|
| 767 |
+
self._mouse_move(event)
|
| 768 |
+
|
| 769 |
+
def _mouse_move(self, event):
|
| 770 |
+
"""Callback for mouse moves in zoom-to-rectangle mode."""
|
| 771 |
+
|
| 772 |
+
if self._xypress:
|
| 773 |
+
x, y = event.x, event.y
|
| 774 |
+
lastx, lasty, a, ind, view = self._xypress[0]
|
| 775 |
+
(x1, y1), (x2, y2) = np.clip(
|
| 776 |
+
[[lastx, lasty], [x, y]], a.bbox.min, a.bbox.max)
|
| 777 |
+
if self._zoom_mode == "x":
|
| 778 |
+
y1, y2 = a.bbox.intervaly
|
| 779 |
+
elif self._zoom_mode == "y":
|
| 780 |
+
x1, x2 = a.bbox.intervalx
|
| 781 |
+
self.toolmanager.trigger_tool(
|
| 782 |
+
'rubberband', self, data=(x1, y1, x2, y2))
|
| 783 |
+
|
| 784 |
+
def _release(self, event):
|
| 785 |
+
"""Callback for mouse button releases in zoom-to-rectangle mode."""
|
| 786 |
+
|
| 787 |
+
for zoom_id in self._ids_zoom:
|
| 788 |
+
self.figure.canvas.mpl_disconnect(zoom_id)
|
| 789 |
+
self._ids_zoom = []
|
| 790 |
+
|
| 791 |
+
if not self._xypress:
|
| 792 |
+
self._cancel_action()
|
| 793 |
+
return
|
| 794 |
+
|
| 795 |
+
done_ax = []
|
| 796 |
+
|
| 797 |
+
for cur_xypress in self._xypress:
|
| 798 |
+
x, y = event.x, event.y
|
| 799 |
+
lastx, lasty, a, _ind, view = cur_xypress
|
| 800 |
+
# ignore singular clicks - 5 pixels is a threshold
|
| 801 |
+
if abs(x - lastx) < 5 or abs(y - lasty) < 5:
|
| 802 |
+
self._cancel_action()
|
| 803 |
+
return
|
| 804 |
+
|
| 805 |
+
# detect twinx, twiny Axes and avoid double zooming
|
| 806 |
+
twinx = any(a.get_shared_x_axes().joined(a, a1) for a1 in done_ax)
|
| 807 |
+
twiny = any(a.get_shared_y_axes().joined(a, a1) for a1 in done_ax)
|
| 808 |
+
done_ax.append(a)
|
| 809 |
+
|
| 810 |
+
if self._button_pressed == 1:
|
| 811 |
+
direction = 'in'
|
| 812 |
+
elif self._button_pressed == 3:
|
| 813 |
+
direction = 'out'
|
| 814 |
+
else:
|
| 815 |
+
continue
|
| 816 |
+
|
| 817 |
+
a._set_view_from_bbox((lastx, lasty, x, y), direction,
|
| 818 |
+
self._zoom_mode, twinx, twiny)
|
| 819 |
+
|
| 820 |
+
self._zoom_mode = None
|
| 821 |
+
self.toolmanager.get_tool(_views_positions).push_current()
|
| 822 |
+
self._cancel_action()
|
| 823 |
+
|
| 824 |
+
|
| 825 |
+
class ToolPan(ZoomPanBase):
|
| 826 |
+
"""Pan Axes with left mouse, zoom with right."""
|
| 827 |
+
|
| 828 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.pan'])
|
| 829 |
+
description = 'Pan axes with left mouse, zoom with right'
|
| 830 |
+
image = 'mpl-data/images/move'
|
| 831 |
+
cursor = cursors.MOVE
|
| 832 |
+
radio_group = 'default'
|
| 833 |
+
|
| 834 |
+
def __init__(self, *args):
|
| 835 |
+
super().__init__(*args)
|
| 836 |
+
self._id_drag = None
|
| 837 |
+
|
| 838 |
+
def _cancel_action(self):
|
| 839 |
+
self._button_pressed = None
|
| 840 |
+
self._xypress = []
|
| 841 |
+
self.figure.canvas.mpl_disconnect(self._id_drag)
|
| 842 |
+
self.toolmanager.messagelock.release(self)
|
| 843 |
+
self.figure.canvas.draw_idle()
|
| 844 |
+
|
| 845 |
+
def _press(self, event):
|
| 846 |
+
if event.button == 1:
|
| 847 |
+
self._button_pressed = 1
|
| 848 |
+
elif event.button == 3:
|
| 849 |
+
self._button_pressed = 3
|
| 850 |
+
else:
|
| 851 |
+
self._cancel_action()
|
| 852 |
+
return
|
| 853 |
+
|
| 854 |
+
x, y = event.x, event.y
|
| 855 |
+
|
| 856 |
+
self._xypress = []
|
| 857 |
+
for i, a in enumerate(self.figure.get_axes()):
|
| 858 |
+
if (x is not None and y is not None and a.in_axes(event) and
|
| 859 |
+
a.get_navigate() and a.can_pan()):
|
| 860 |
+
a.start_pan(x, y, event.button)
|
| 861 |
+
self._xypress.append((a, i))
|
| 862 |
+
self.toolmanager.messagelock(self)
|
| 863 |
+
self._id_drag = self.figure.canvas.mpl_connect(
|
| 864 |
+
'motion_notify_event', self._mouse_move)
|
| 865 |
+
|
| 866 |
+
def _release(self, event):
|
| 867 |
+
if self._button_pressed is None:
|
| 868 |
+
self._cancel_action()
|
| 869 |
+
return
|
| 870 |
+
|
| 871 |
+
self.figure.canvas.mpl_disconnect(self._id_drag)
|
| 872 |
+
self.toolmanager.messagelock.release(self)
|
| 873 |
+
|
| 874 |
+
for a, _ind in self._xypress:
|
| 875 |
+
a.end_pan()
|
| 876 |
+
if not self._xypress:
|
| 877 |
+
self._cancel_action()
|
| 878 |
+
return
|
| 879 |
+
|
| 880 |
+
self.toolmanager.get_tool(_views_positions).push_current()
|
| 881 |
+
self._cancel_action()
|
| 882 |
+
|
| 883 |
+
def _mouse_move(self, event):
|
| 884 |
+
for a, _ind in self._xypress:
|
| 885 |
+
# safer to use the recorded button at the _press than current
|
| 886 |
+
# button: # multiple button can get pressed during motion...
|
| 887 |
+
a.drag_pan(self._button_pressed, event.key, event.x, event.y)
|
| 888 |
+
self.toolmanager.canvas.draw_idle()
|
| 889 |
+
|
| 890 |
+
|
| 891 |
+
class ToolHelpBase(ToolBase):
|
| 892 |
+
description = 'Print tool list, shortcuts and description'
|
| 893 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.help'])
|
| 894 |
+
image = 'mpl-data/images/help'
|
| 895 |
+
|
| 896 |
+
@staticmethod
|
| 897 |
+
def format_shortcut(key_sequence):
|
| 898 |
+
"""
|
| 899 |
+
Convert a shortcut string from the notation used in rc config to the
|
| 900 |
+
standard notation for displaying shortcuts, e.g. 'ctrl+a' -> 'Ctrl+A'.
|
| 901 |
+
"""
|
| 902 |
+
return (key_sequence if len(key_sequence) == 1 else
|
| 903 |
+
re.sub(r"\+[A-Z]", r"+Shift\g<0>", key_sequence).title())
|
| 904 |
+
|
| 905 |
+
def _format_tool_keymap(self, name):
|
| 906 |
+
keymaps = self.toolmanager.get_tool_keymap(name)
|
| 907 |
+
return ", ".join(self.format_shortcut(keymap) for keymap in keymaps)
|
| 908 |
+
|
| 909 |
+
def _get_help_entries(self):
|
| 910 |
+
return [(name, self._format_tool_keymap(name), tool.description)
|
| 911 |
+
for name, tool in sorted(self.toolmanager.tools.items())
|
| 912 |
+
if tool.description]
|
| 913 |
+
|
| 914 |
+
def _get_help_text(self):
|
| 915 |
+
entries = self._get_help_entries()
|
| 916 |
+
entries = ["{}: {}\n\t{}".format(*entry) for entry in entries]
|
| 917 |
+
return "\n".join(entries)
|
| 918 |
+
|
| 919 |
+
def _get_help_html(self):
|
| 920 |
+
fmt = "<tr><td>{}</td><td>{}</td><td>{}</td></tr>"
|
| 921 |
+
rows = [fmt.format(
|
| 922 |
+
"<b>Action</b>", "<b>Shortcuts</b>", "<b>Description</b>")]
|
| 923 |
+
rows += [fmt.format(*row) for row in self._get_help_entries()]
|
| 924 |
+
return ("<style>td {padding: 0px 4px}</style>"
|
| 925 |
+
"<table><thead>" + rows[0] + "</thead>"
|
| 926 |
+
"<tbody>".join(rows[1:]) + "</tbody></table>")
|
| 927 |
+
|
| 928 |
+
|
| 929 |
+
class ToolCopyToClipboardBase(ToolBase):
|
| 930 |
+
"""Tool to copy the figure to the clipboard."""
|
| 931 |
+
|
| 932 |
+
description = 'Copy the canvas figure to clipboard'
|
| 933 |
+
default_keymap = property(lambda self: mpl.rcParams['keymap.copy'])
|
| 934 |
+
|
| 935 |
+
def trigger(self, *args, **kwargs):
|
| 936 |
+
message = "Copy tool is not available"
|
| 937 |
+
self.toolmanager.message_event(message, self)
|
| 938 |
+
|
| 939 |
+
|
| 940 |
+
default_tools = {'home': ToolHome, 'back': ToolBack, 'forward': ToolForward,
|
| 941 |
+
'zoom': ToolZoom, 'pan': ToolPan,
|
| 942 |
+
'subplots': ConfigureSubplotsBase,
|
| 943 |
+
'save': SaveFigureBase,
|
| 944 |
+
'grid': ToolGrid,
|
| 945 |
+
'grid_minor': ToolMinorGrid,
|
| 946 |
+
'fullscreen': ToolFullScreen,
|
| 947 |
+
'quit': ToolQuit,
|
| 948 |
+
'quit_all': ToolQuitAll,
|
| 949 |
+
'xscale': ToolXScale,
|
| 950 |
+
'yscale': ToolYScale,
|
| 951 |
+
'position': ToolCursorPosition,
|
| 952 |
+
_views_positions: ToolViewsPositions,
|
| 953 |
+
'cursor': ToolSetCursor,
|
| 954 |
+
'rubberband': RubberbandBase,
|
| 955 |
+
'help': ToolHelpBase,
|
| 956 |
+
'copy': ToolCopyToClipboardBase,
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
+
default_toolbar_tools = [['navigation', ['home', 'back', 'forward']],
|
| 960 |
+
['zoompan', ['pan', 'zoom', 'subplots']],
|
| 961 |
+
['io', ['save', 'help']]]
|
| 962 |
+
|
| 963 |
+
|
| 964 |
+
def add_tools_to_manager(toolmanager, tools=default_tools):
|
| 965 |
+
"""
|
| 966 |
+
Add multiple tools to a `.ToolManager`.
|
| 967 |
+
|
| 968 |
+
Parameters
|
| 969 |
+
----------
|
| 970 |
+
toolmanager : `.backend_managers.ToolManager`
|
| 971 |
+
Manager to which the tools are added.
|
| 972 |
+
tools : {str: class_like}, optional
|
| 973 |
+
The tools to add in a {name: tool} dict, see
|
| 974 |
+
`.backend_managers.ToolManager.add_tool` for more info.
|
| 975 |
+
"""
|
| 976 |
+
|
| 977 |
+
for name, tool in tools.items():
|
| 978 |
+
toolmanager.add_tool(name, tool)
|
| 979 |
+
|
| 980 |
+
|
| 981 |
+
def add_tools_to_container(container, tools=default_toolbar_tools):
|
| 982 |
+
"""
|
| 983 |
+
Add multiple tools to the container.
|
| 984 |
+
|
| 985 |
+
Parameters
|
| 986 |
+
----------
|
| 987 |
+
container : Container
|
| 988 |
+
`.backend_bases.ToolContainerBase` object that will get the tools
|
| 989 |
+
added.
|
| 990 |
+
tools : list, optional
|
| 991 |
+
List in the form ``[[group1, [tool1, tool2 ...]], [group2, [...]]]``
|
| 992 |
+
where the tools ``[tool1, tool2, ...]`` will display in group1.
|
| 993 |
+
See `.backend_bases.ToolContainerBase.add_tool` for details.
|
| 994 |
+
"""
|
| 995 |
+
|
| 996 |
+
for group, grouptools in tools:
|
| 997 |
+
for position, tool in enumerate(grouptools):
|
| 998 |
+
container.add_tool(tool, group, position)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/backend_tools.pyi
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import enum
|
| 2 |
+
from matplotlib import cbook
|
| 3 |
+
from matplotlib.axes import Axes
|
| 4 |
+
from matplotlib.backend_bases import ToolContainerBase, FigureCanvasBase
|
| 5 |
+
from matplotlib.backend_managers import ToolManager, ToolEvent
|
| 6 |
+
from matplotlib.figure import Figure
|
| 7 |
+
from matplotlib.scale import ScaleBase
|
| 8 |
+
|
| 9 |
+
from typing import Any, cast
|
| 10 |
+
|
| 11 |
+
class Cursors(enum.IntEnum):
|
| 12 |
+
POINTER = cast(int, ...)
|
| 13 |
+
HAND = cast(int, ...)
|
| 14 |
+
SELECT_REGION = cast(int, ...)
|
| 15 |
+
MOVE = cast(int, ...)
|
| 16 |
+
WAIT = cast(int, ...)
|
| 17 |
+
RESIZE_HORIZONTAL = cast(int, ...)
|
| 18 |
+
RESIZE_VERTICAL = cast(int, ...)
|
| 19 |
+
|
| 20 |
+
cursors = Cursors
|
| 21 |
+
|
| 22 |
+
class ToolBase:
|
| 23 |
+
@property
|
| 24 |
+
def default_keymap(self) -> list[str] | None: ...
|
| 25 |
+
description: str | None
|
| 26 |
+
image: str | None
|
| 27 |
+
def __init__(self, toolmanager: ToolManager, name: str) -> None: ...
|
| 28 |
+
@property
|
| 29 |
+
def name(self) -> str: ...
|
| 30 |
+
@property
|
| 31 |
+
def toolmanager(self) -> ToolManager: ...
|
| 32 |
+
@property
|
| 33 |
+
def canvas(self) -> FigureCanvasBase | None: ...
|
| 34 |
+
@property
|
| 35 |
+
def figure(self) -> Figure | None: ...
|
| 36 |
+
@figure.setter
|
| 37 |
+
def figure(self, figure: Figure | None) -> None: ...
|
| 38 |
+
def set_figure(self, figure: Figure | None) -> None: ...
|
| 39 |
+
def trigger(self, sender: Any, event: ToolEvent, data: Any = ...) -> None: ...
|
| 40 |
+
|
| 41 |
+
class ToolToggleBase(ToolBase):
|
| 42 |
+
radio_group: str | None
|
| 43 |
+
cursor: Cursors | None
|
| 44 |
+
default_toggled: bool
|
| 45 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 46 |
+
def enable(self, event: ToolEvent | None = ...) -> None: ...
|
| 47 |
+
def disable(self, event: ToolEvent | None = ...) -> None: ...
|
| 48 |
+
@property
|
| 49 |
+
def toggled(self) -> bool: ...
|
| 50 |
+
def set_figure(self, figure: Figure | None) -> None: ...
|
| 51 |
+
|
| 52 |
+
class ToolSetCursor(ToolBase): ...
|
| 53 |
+
|
| 54 |
+
class ToolCursorPosition(ToolBase):
|
| 55 |
+
def send_message(self, event: ToolEvent) -> None: ...
|
| 56 |
+
|
| 57 |
+
class RubberbandBase(ToolBase):
|
| 58 |
+
def draw_rubberband(self, *data) -> None: ...
|
| 59 |
+
def remove_rubberband(self) -> None: ...
|
| 60 |
+
|
| 61 |
+
class ToolQuit(ToolBase): ...
|
| 62 |
+
class ToolQuitAll(ToolBase): ...
|
| 63 |
+
class ToolGrid(ToolBase): ...
|
| 64 |
+
class ToolMinorGrid(ToolBase): ...
|
| 65 |
+
class ToolFullScreen(ToolBase): ...
|
| 66 |
+
|
| 67 |
+
class AxisScaleBase(ToolToggleBase):
|
| 68 |
+
def enable(self, event: ToolEvent | None = ...) -> None: ...
|
| 69 |
+
def disable(self, event: ToolEvent | None = ...) -> None: ...
|
| 70 |
+
|
| 71 |
+
class ToolYScale(AxisScaleBase):
|
| 72 |
+
def set_scale(self, ax: Axes, scale: str | ScaleBase) -> None: ...
|
| 73 |
+
|
| 74 |
+
class ToolXScale(AxisScaleBase):
|
| 75 |
+
def set_scale(self, ax, scale: str | ScaleBase) -> None: ...
|
| 76 |
+
|
| 77 |
+
class ToolViewsPositions(ToolBase):
|
| 78 |
+
views: dict[Figure | Axes, cbook._Stack]
|
| 79 |
+
positions: dict[Figure | Axes, cbook._Stack]
|
| 80 |
+
home_views: dict[Figure, dict[Axes, tuple[float, float, float, float]]]
|
| 81 |
+
def add_figure(self, figure: Figure) -> None: ...
|
| 82 |
+
def clear(self, figure: Figure) -> None: ...
|
| 83 |
+
def update_view(self) -> None: ...
|
| 84 |
+
def push_current(self, figure: Figure | None = ...) -> None: ...
|
| 85 |
+
def update_home_views(self, figure: Figure | None = ...) -> None: ...
|
| 86 |
+
def home(self) -> None: ...
|
| 87 |
+
def back(self) -> None: ...
|
| 88 |
+
def forward(self) -> None: ...
|
| 89 |
+
|
| 90 |
+
class ViewsPositionsBase(ToolBase): ...
|
| 91 |
+
class ToolHome(ViewsPositionsBase): ...
|
| 92 |
+
class ToolBack(ViewsPositionsBase): ...
|
| 93 |
+
class ToolForward(ViewsPositionsBase): ...
|
| 94 |
+
class ConfigureSubplotsBase(ToolBase): ...
|
| 95 |
+
class SaveFigureBase(ToolBase): ...
|
| 96 |
+
|
| 97 |
+
class ZoomPanBase(ToolToggleBase):
|
| 98 |
+
base_scale: float
|
| 99 |
+
scrollthresh: float
|
| 100 |
+
lastscroll: float
|
| 101 |
+
def __init__(self, *args) -> None: ...
|
| 102 |
+
def enable(self, event: ToolEvent | None = ...) -> None: ...
|
| 103 |
+
def disable(self, event: ToolEvent | None = ...) -> None: ...
|
| 104 |
+
def scroll_zoom(self, event: ToolEvent) -> None: ...
|
| 105 |
+
|
| 106 |
+
class ToolZoom(ZoomPanBase): ...
|
| 107 |
+
class ToolPan(ZoomPanBase): ...
|
| 108 |
+
|
| 109 |
+
class ToolHelpBase(ToolBase):
|
| 110 |
+
@staticmethod
|
| 111 |
+
def format_shortcut(key_sequence: str) -> str: ...
|
| 112 |
+
|
| 113 |
+
class ToolCopyToClipboardBase(ToolBase): ...
|
| 114 |
+
|
| 115 |
+
default_tools: dict[str, ToolBase]
|
| 116 |
+
default_toolbar_tools: list[list[str | list[str]]]
|
| 117 |
+
|
| 118 |
+
def add_tools_to_manager(
|
| 119 |
+
toolmanager: ToolManager, tools: dict[str, type[ToolBase]] = ...
|
| 120 |
+
) -> None: ...
|
| 121 |
+
def add_tools_to_container(container: ToolContainerBase, tools: list[Any] = ...) -> None: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/bezier.py
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A module providing some utility functions regarding Bézier path manipulation.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from functools import lru_cache
|
| 6 |
+
import math
|
| 7 |
+
import warnings
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
|
| 11 |
+
from matplotlib import _api
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# same algorithm as 3.8's math.comb
|
| 15 |
+
@np.vectorize
|
| 16 |
+
@lru_cache(maxsize=128)
|
| 17 |
+
def _comb(n, k):
|
| 18 |
+
if k > n:
|
| 19 |
+
return 0
|
| 20 |
+
k = min(k, n - k)
|
| 21 |
+
i = np.arange(1, k + 1)
|
| 22 |
+
return np.prod((n + 1 - i)/i).astype(int)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class NonIntersectingPathException(ValueError):
|
| 26 |
+
pass
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# some functions
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def get_intersection(cx1, cy1, cos_t1, sin_t1,
|
| 33 |
+
cx2, cy2, cos_t2, sin_t2):
|
| 34 |
+
"""
|
| 35 |
+
Return the intersection between the line through (*cx1*, *cy1*) at angle
|
| 36 |
+
*t1* and the line through (*cx2*, *cy2*) at angle *t2*.
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
# line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0.
|
| 40 |
+
# line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1
|
| 41 |
+
|
| 42 |
+
line1_rhs = sin_t1 * cx1 - cos_t1 * cy1
|
| 43 |
+
line2_rhs = sin_t2 * cx2 - cos_t2 * cy2
|
| 44 |
+
|
| 45 |
+
# rhs matrix
|
| 46 |
+
a, b = sin_t1, -cos_t1
|
| 47 |
+
c, d = sin_t2, -cos_t2
|
| 48 |
+
|
| 49 |
+
ad_bc = a * d - b * c
|
| 50 |
+
if abs(ad_bc) < 1e-12:
|
| 51 |
+
raise ValueError("Given lines do not intersect. Please verify that "
|
| 52 |
+
"the angles are not equal or differ by 180 degrees.")
|
| 53 |
+
|
| 54 |
+
# rhs_inverse
|
| 55 |
+
a_, b_ = d, -b
|
| 56 |
+
c_, d_ = -c, a
|
| 57 |
+
a_, b_, c_, d_ = (k / ad_bc for k in [a_, b_, c_, d_])
|
| 58 |
+
|
| 59 |
+
x = a_ * line1_rhs + b_ * line2_rhs
|
| 60 |
+
y = c_ * line1_rhs + d_ * line2_rhs
|
| 61 |
+
|
| 62 |
+
return x, y
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def get_normal_points(cx, cy, cos_t, sin_t, length):
|
| 66 |
+
"""
|
| 67 |
+
For a line passing through (*cx*, *cy*) and having an angle *t*, return
|
| 68 |
+
locations of the two points located along its perpendicular line at the
|
| 69 |
+
distance of *length*.
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
if length == 0.:
|
| 73 |
+
return cx, cy, cx, cy
|
| 74 |
+
|
| 75 |
+
cos_t1, sin_t1 = sin_t, -cos_t
|
| 76 |
+
cos_t2, sin_t2 = -sin_t, cos_t
|
| 77 |
+
|
| 78 |
+
x1, y1 = length * cos_t1 + cx, length * sin_t1 + cy
|
| 79 |
+
x2, y2 = length * cos_t2 + cx, length * sin_t2 + cy
|
| 80 |
+
|
| 81 |
+
return x1, y1, x2, y2
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
# BEZIER routines
|
| 85 |
+
|
| 86 |
+
# subdividing bezier curve
|
| 87 |
+
# http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/Bezier/bezier-sub.html
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def _de_casteljau1(beta, t):
|
| 91 |
+
next_beta = beta[:-1] * (1 - t) + beta[1:] * t
|
| 92 |
+
return next_beta
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def split_de_casteljau(beta, t):
|
| 96 |
+
"""
|
| 97 |
+
Split a Bézier segment defined by its control points *beta* into two
|
| 98 |
+
separate segments divided at *t* and return their control points.
|
| 99 |
+
"""
|
| 100 |
+
beta = np.asarray(beta)
|
| 101 |
+
beta_list = [beta]
|
| 102 |
+
while True:
|
| 103 |
+
beta = _de_casteljau1(beta, t)
|
| 104 |
+
beta_list.append(beta)
|
| 105 |
+
if len(beta) == 1:
|
| 106 |
+
break
|
| 107 |
+
left_beta = [beta[0] for beta in beta_list]
|
| 108 |
+
right_beta = [beta[-1] for beta in reversed(beta_list)]
|
| 109 |
+
|
| 110 |
+
return left_beta, right_beta
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def find_bezier_t_intersecting_with_closedpath(
|
| 114 |
+
bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerance=0.01):
|
| 115 |
+
"""
|
| 116 |
+
Find the intersection of the Bézier curve with a closed path.
|
| 117 |
+
|
| 118 |
+
The intersection point *t* is approximated by two parameters *t0*, *t1*
|
| 119 |
+
such that *t0* <= *t* <= *t1*.
|
| 120 |
+
|
| 121 |
+
Search starts from *t0* and *t1* and uses a simple bisecting algorithm
|
| 122 |
+
therefore one of the end points must be inside the path while the other
|
| 123 |
+
doesn't. The search stops when the distance of the points parametrized by
|
| 124 |
+
*t0* and *t1* gets smaller than the given *tolerance*.
|
| 125 |
+
|
| 126 |
+
Parameters
|
| 127 |
+
----------
|
| 128 |
+
bezier_point_at_t : callable
|
| 129 |
+
A function returning x, y coordinates of the Bézier at parameter *t*.
|
| 130 |
+
It must have the signature::
|
| 131 |
+
|
| 132 |
+
bezier_point_at_t(t: float) -> tuple[float, float]
|
| 133 |
+
|
| 134 |
+
inside_closedpath : callable
|
| 135 |
+
A function returning True if a given point (x, y) is inside the
|
| 136 |
+
closed path. It must have the signature::
|
| 137 |
+
|
| 138 |
+
inside_closedpath(point: tuple[float, float]) -> bool
|
| 139 |
+
|
| 140 |
+
t0, t1 : float
|
| 141 |
+
Start parameters for the search.
|
| 142 |
+
|
| 143 |
+
tolerance : float
|
| 144 |
+
Maximal allowed distance between the final points.
|
| 145 |
+
|
| 146 |
+
Returns
|
| 147 |
+
-------
|
| 148 |
+
t0, t1 : float
|
| 149 |
+
The Bézier path parameters.
|
| 150 |
+
"""
|
| 151 |
+
start = bezier_point_at_t(t0)
|
| 152 |
+
end = bezier_point_at_t(t1)
|
| 153 |
+
|
| 154 |
+
start_inside = inside_closedpath(start)
|
| 155 |
+
end_inside = inside_closedpath(end)
|
| 156 |
+
|
| 157 |
+
if start_inside == end_inside and start != end:
|
| 158 |
+
raise NonIntersectingPathException(
|
| 159 |
+
"Both points are on the same side of the closed path")
|
| 160 |
+
|
| 161 |
+
while True:
|
| 162 |
+
|
| 163 |
+
# return if the distance is smaller than the tolerance
|
| 164 |
+
if np.hypot(start[0] - end[0], start[1] - end[1]) < tolerance:
|
| 165 |
+
return t0, t1
|
| 166 |
+
|
| 167 |
+
# calculate the middle point
|
| 168 |
+
middle_t = 0.5 * (t0 + t1)
|
| 169 |
+
middle = bezier_point_at_t(middle_t)
|
| 170 |
+
middle_inside = inside_closedpath(middle)
|
| 171 |
+
|
| 172 |
+
if start_inside ^ middle_inside:
|
| 173 |
+
t1 = middle_t
|
| 174 |
+
if end == middle:
|
| 175 |
+
# Edge case where infinite loop is possible
|
| 176 |
+
# Caused by large numbers relative to tolerance
|
| 177 |
+
return t0, t1
|
| 178 |
+
end = middle
|
| 179 |
+
else:
|
| 180 |
+
t0 = middle_t
|
| 181 |
+
if start == middle:
|
| 182 |
+
# Edge case where infinite loop is possible
|
| 183 |
+
# Caused by large numbers relative to tolerance
|
| 184 |
+
return t0, t1
|
| 185 |
+
start = middle
|
| 186 |
+
start_inside = middle_inside
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
class BezierSegment:
|
| 190 |
+
"""
|
| 191 |
+
A d-dimensional Bézier segment.
|
| 192 |
+
|
| 193 |
+
Parameters
|
| 194 |
+
----------
|
| 195 |
+
control_points : (N, d) array
|
| 196 |
+
Location of the *N* control points.
|
| 197 |
+
"""
|
| 198 |
+
|
| 199 |
+
def __init__(self, control_points):
|
| 200 |
+
self._cpoints = np.asarray(control_points)
|
| 201 |
+
self._N, self._d = self._cpoints.shape
|
| 202 |
+
self._orders = np.arange(self._N)
|
| 203 |
+
coeff = [math.factorial(self._N - 1)
|
| 204 |
+
// (math.factorial(i) * math.factorial(self._N - 1 - i))
|
| 205 |
+
for i in range(self._N)]
|
| 206 |
+
self._px = (self._cpoints.T * coeff).T
|
| 207 |
+
|
| 208 |
+
def __call__(self, t):
|
| 209 |
+
"""
|
| 210 |
+
Evaluate the Bézier curve at point(s) *t* in [0, 1].
|
| 211 |
+
|
| 212 |
+
Parameters
|
| 213 |
+
----------
|
| 214 |
+
t : (k,) array-like
|
| 215 |
+
Points at which to evaluate the curve.
|
| 216 |
+
|
| 217 |
+
Returns
|
| 218 |
+
-------
|
| 219 |
+
(k, d) array
|
| 220 |
+
Value of the curve for each point in *t*.
|
| 221 |
+
"""
|
| 222 |
+
t = np.asarray(t)
|
| 223 |
+
return (np.power.outer(1 - t, self._orders[::-1])
|
| 224 |
+
* np.power.outer(t, self._orders)) @ self._px
|
| 225 |
+
|
| 226 |
+
def point_at_t(self, t):
|
| 227 |
+
"""
|
| 228 |
+
Evaluate the curve at a single point, returning a tuple of *d* floats.
|
| 229 |
+
"""
|
| 230 |
+
return tuple(self(t))
|
| 231 |
+
|
| 232 |
+
@property
|
| 233 |
+
def control_points(self):
|
| 234 |
+
"""The control points of the curve."""
|
| 235 |
+
return self._cpoints
|
| 236 |
+
|
| 237 |
+
@property
|
| 238 |
+
def dimension(self):
|
| 239 |
+
"""The dimension of the curve."""
|
| 240 |
+
return self._d
|
| 241 |
+
|
| 242 |
+
@property
|
| 243 |
+
def degree(self):
|
| 244 |
+
"""Degree of the polynomial. One less the number of control points."""
|
| 245 |
+
return self._N - 1
|
| 246 |
+
|
| 247 |
+
@property
|
| 248 |
+
def polynomial_coefficients(self):
|
| 249 |
+
r"""
|
| 250 |
+
The polynomial coefficients of the Bézier curve.
|
| 251 |
+
|
| 252 |
+
.. warning:: Follows opposite convention from `numpy.polyval`.
|
| 253 |
+
|
| 254 |
+
Returns
|
| 255 |
+
-------
|
| 256 |
+
(n+1, d) array
|
| 257 |
+
Coefficients after expanding in polynomial basis, where :math:`n`
|
| 258 |
+
is the degree of the Bézier curve and :math:`d` its dimension.
|
| 259 |
+
These are the numbers (:math:`C_j`) such that the curve can be
|
| 260 |
+
written :math:`\sum_{j=0}^n C_j t^j`.
|
| 261 |
+
|
| 262 |
+
Notes
|
| 263 |
+
-----
|
| 264 |
+
The coefficients are calculated as
|
| 265 |
+
|
| 266 |
+
.. math::
|
| 267 |
+
|
| 268 |
+
{n \choose j} \sum_{i=0}^j (-1)^{i+j} {j \choose i} P_i
|
| 269 |
+
|
| 270 |
+
where :math:`P_i` are the control points of the curve.
|
| 271 |
+
"""
|
| 272 |
+
n = self.degree
|
| 273 |
+
# matplotlib uses n <= 4. overflow plausible starting around n = 15.
|
| 274 |
+
if n > 10:
|
| 275 |
+
warnings.warn("Polynomial coefficients formula unstable for high "
|
| 276 |
+
"order Bezier curves!", RuntimeWarning)
|
| 277 |
+
P = self.control_points
|
| 278 |
+
j = np.arange(n+1)[:, None]
|
| 279 |
+
i = np.arange(n+1)[None, :] # _comb is non-zero for i <= j
|
| 280 |
+
prefactor = (-1)**(i + j) * _comb(j, i) # j on axis 0, i on axis 1
|
| 281 |
+
return _comb(n, j) * prefactor @ P # j on axis 0, self.dimension on 1
|
| 282 |
+
|
| 283 |
+
def axis_aligned_extrema(self):
|
| 284 |
+
"""
|
| 285 |
+
Return the dimension and location of the curve's interior extrema.
|
| 286 |
+
|
| 287 |
+
The extrema are the points along the curve where one of its partial
|
| 288 |
+
derivatives is zero.
|
| 289 |
+
|
| 290 |
+
Returns
|
| 291 |
+
-------
|
| 292 |
+
dims : array of int
|
| 293 |
+
Index :math:`i` of the partial derivative which is zero at each
|
| 294 |
+
interior extrema.
|
| 295 |
+
dzeros : array of float
|
| 296 |
+
Of same size as dims. The :math:`t` such that :math:`d/dx_i B(t) =
|
| 297 |
+
0`
|
| 298 |
+
"""
|
| 299 |
+
n = self.degree
|
| 300 |
+
if n <= 1:
|
| 301 |
+
return np.array([]), np.array([])
|
| 302 |
+
Cj = self.polynomial_coefficients
|
| 303 |
+
dCj = np.arange(1, n+1)[:, None] * Cj[1:]
|
| 304 |
+
dims = []
|
| 305 |
+
roots = []
|
| 306 |
+
for i, pi in enumerate(dCj.T):
|
| 307 |
+
r = np.roots(pi[::-1])
|
| 308 |
+
roots.append(r)
|
| 309 |
+
dims.append(np.full_like(r, i))
|
| 310 |
+
roots = np.concatenate(roots)
|
| 311 |
+
dims = np.concatenate(dims)
|
| 312 |
+
in_range = np.isreal(roots) & (roots >= 0) & (roots <= 1)
|
| 313 |
+
return dims[in_range], np.real(roots)[in_range]
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def split_bezier_intersecting_with_closedpath(
|
| 317 |
+
bezier, inside_closedpath, tolerance=0.01):
|
| 318 |
+
"""
|
| 319 |
+
Split a Bézier curve into two at the intersection with a closed path.
|
| 320 |
+
|
| 321 |
+
Parameters
|
| 322 |
+
----------
|
| 323 |
+
bezier : (N, 2) array-like
|
| 324 |
+
Control points of the Bézier segment. See `.BezierSegment`.
|
| 325 |
+
inside_closedpath : callable
|
| 326 |
+
A function returning True if a given point (x, y) is inside the
|
| 327 |
+
closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
|
| 328 |
+
tolerance : float
|
| 329 |
+
The tolerance for the intersection. See also
|
| 330 |
+
`.find_bezier_t_intersecting_with_closedpath`.
|
| 331 |
+
|
| 332 |
+
Returns
|
| 333 |
+
-------
|
| 334 |
+
left, right
|
| 335 |
+
Lists of control points for the two Bézier segments.
|
| 336 |
+
"""
|
| 337 |
+
|
| 338 |
+
bz = BezierSegment(bezier)
|
| 339 |
+
bezier_point_at_t = bz.point_at_t
|
| 340 |
+
|
| 341 |
+
t0, t1 = find_bezier_t_intersecting_with_closedpath(
|
| 342 |
+
bezier_point_at_t, inside_closedpath, tolerance=tolerance)
|
| 343 |
+
|
| 344 |
+
_left, _right = split_de_casteljau(bezier, (t0 + t1) / 2.)
|
| 345 |
+
return _left, _right
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
# matplotlib specific
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
def split_path_inout(path, inside, tolerance=0.01, reorder_inout=False):
|
| 352 |
+
"""
|
| 353 |
+
Divide a path into two segments at the point where ``inside(x, y)`` becomes
|
| 354 |
+
False.
|
| 355 |
+
"""
|
| 356 |
+
from .path import Path
|
| 357 |
+
path_iter = path.iter_segments()
|
| 358 |
+
|
| 359 |
+
ctl_points, command = next(path_iter)
|
| 360 |
+
begin_inside = inside(ctl_points[-2:]) # true if begin point is inside
|
| 361 |
+
|
| 362 |
+
ctl_points_old = ctl_points
|
| 363 |
+
|
| 364 |
+
iold = 0
|
| 365 |
+
i = 1
|
| 366 |
+
|
| 367 |
+
for ctl_points, command in path_iter:
|
| 368 |
+
iold = i
|
| 369 |
+
i += len(ctl_points) // 2
|
| 370 |
+
if inside(ctl_points[-2:]) != begin_inside:
|
| 371 |
+
bezier_path = np.concatenate([ctl_points_old[-2:], ctl_points])
|
| 372 |
+
break
|
| 373 |
+
ctl_points_old = ctl_points
|
| 374 |
+
else:
|
| 375 |
+
raise ValueError("The path does not intersect with the patch")
|
| 376 |
+
|
| 377 |
+
bp = bezier_path.reshape((-1, 2))
|
| 378 |
+
left, right = split_bezier_intersecting_with_closedpath(
|
| 379 |
+
bp, inside, tolerance)
|
| 380 |
+
if len(left) == 2:
|
| 381 |
+
codes_left = [Path.LINETO]
|
| 382 |
+
codes_right = [Path.MOVETO, Path.LINETO]
|
| 383 |
+
elif len(left) == 3:
|
| 384 |
+
codes_left = [Path.CURVE3, Path.CURVE3]
|
| 385 |
+
codes_right = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
|
| 386 |
+
elif len(left) == 4:
|
| 387 |
+
codes_left = [Path.CURVE4, Path.CURVE4, Path.CURVE4]
|
| 388 |
+
codes_right = [Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4]
|
| 389 |
+
else:
|
| 390 |
+
raise AssertionError("This should never be reached")
|
| 391 |
+
|
| 392 |
+
verts_left = left[1:]
|
| 393 |
+
verts_right = right[:]
|
| 394 |
+
|
| 395 |
+
if path.codes is None:
|
| 396 |
+
path_in = Path(np.concatenate([path.vertices[:i], verts_left]))
|
| 397 |
+
path_out = Path(np.concatenate([verts_right, path.vertices[i:]]))
|
| 398 |
+
|
| 399 |
+
else:
|
| 400 |
+
path_in = Path(np.concatenate([path.vertices[:iold], verts_left]),
|
| 401 |
+
np.concatenate([path.codes[:iold], codes_left]))
|
| 402 |
+
|
| 403 |
+
path_out = Path(np.concatenate([verts_right, path.vertices[i:]]),
|
| 404 |
+
np.concatenate([codes_right, path.codes[i:]]))
|
| 405 |
+
|
| 406 |
+
if reorder_inout and not begin_inside:
|
| 407 |
+
path_in, path_out = path_out, path_in
|
| 408 |
+
|
| 409 |
+
return path_in, path_out
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
def inside_circle(cx, cy, r):
|
| 413 |
+
"""
|
| 414 |
+
Return a function that checks whether a point is in a circle with center
|
| 415 |
+
(*cx*, *cy*) and radius *r*.
|
| 416 |
+
|
| 417 |
+
The returned function has the signature::
|
| 418 |
+
|
| 419 |
+
f(xy: tuple[float, float]) -> bool
|
| 420 |
+
"""
|
| 421 |
+
r2 = r ** 2
|
| 422 |
+
|
| 423 |
+
def _f(xy):
|
| 424 |
+
x, y = xy
|
| 425 |
+
return (x - cx) ** 2 + (y - cy) ** 2 < r2
|
| 426 |
+
return _f
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
# quadratic Bezier lines
|
| 430 |
+
|
| 431 |
+
def get_cos_sin(x0, y0, x1, y1):
|
| 432 |
+
dx, dy = x1 - x0, y1 - y0
|
| 433 |
+
d = (dx * dx + dy * dy) ** .5
|
| 434 |
+
# Account for divide by zero
|
| 435 |
+
if d == 0:
|
| 436 |
+
return 0.0, 0.0
|
| 437 |
+
return dx / d, dy / d
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):
|
| 441 |
+
"""
|
| 442 |
+
Check if two lines are parallel.
|
| 443 |
+
|
| 444 |
+
Parameters
|
| 445 |
+
----------
|
| 446 |
+
dx1, dy1, dx2, dy2 : float
|
| 447 |
+
The gradients *dy*/*dx* of the two lines.
|
| 448 |
+
tolerance : float
|
| 449 |
+
The angular tolerance in radians up to which the lines are considered
|
| 450 |
+
parallel.
|
| 451 |
+
|
| 452 |
+
Returns
|
| 453 |
+
-------
|
| 454 |
+
is_parallel
|
| 455 |
+
- 1 if two lines are parallel in same direction.
|
| 456 |
+
- -1 if two lines are parallel in opposite direction.
|
| 457 |
+
- False otherwise.
|
| 458 |
+
"""
|
| 459 |
+
theta1 = np.arctan2(dx1, dy1)
|
| 460 |
+
theta2 = np.arctan2(dx2, dy2)
|
| 461 |
+
dtheta = abs(theta1 - theta2)
|
| 462 |
+
if dtheta < tolerance:
|
| 463 |
+
return 1
|
| 464 |
+
elif abs(dtheta - np.pi) < tolerance:
|
| 465 |
+
return -1
|
| 466 |
+
else:
|
| 467 |
+
return False
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
def get_parallels(bezier2, width):
|
| 471 |
+
"""
|
| 472 |
+
Given the quadratic Bézier control points *bezier2*, returns
|
| 473 |
+
control points of quadratic Bézier lines roughly parallel to given
|
| 474 |
+
one separated by *width*.
|
| 475 |
+
"""
|
| 476 |
+
|
| 477 |
+
# The parallel Bezier lines are constructed by following ways.
|
| 478 |
+
# c1 and c2 are control points representing the start and end of the
|
| 479 |
+
# Bezier line.
|
| 480 |
+
# cm is the middle point
|
| 481 |
+
|
| 482 |
+
c1x, c1y = bezier2[0]
|
| 483 |
+
cmx, cmy = bezier2[1]
|
| 484 |
+
c2x, c2y = bezier2[2]
|
| 485 |
+
|
| 486 |
+
parallel_test = check_if_parallel(c1x - cmx, c1y - cmy,
|
| 487 |
+
cmx - c2x, cmy - c2y)
|
| 488 |
+
|
| 489 |
+
if parallel_test == -1:
|
| 490 |
+
_api.warn_external(
|
| 491 |
+
"Lines do not intersect. A straight line is used instead.")
|
| 492 |
+
cos_t1, sin_t1 = get_cos_sin(c1x, c1y, c2x, c2y)
|
| 493 |
+
cos_t2, sin_t2 = cos_t1, sin_t1
|
| 494 |
+
else:
|
| 495 |
+
# t1 and t2 is the angle between c1 and cm, cm, c2. They are
|
| 496 |
+
# also an angle of the tangential line of the path at c1 and c2
|
| 497 |
+
cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
|
| 498 |
+
cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c2x, c2y)
|
| 499 |
+
|
| 500 |
+
# find c1_left, c1_right which are located along the lines
|
| 501 |
+
# through c1 and perpendicular to the tangential lines of the
|
| 502 |
+
# Bezier path at a distance of width. Same thing for c2_left and
|
| 503 |
+
# c2_right with respect to c2.
|
| 504 |
+
c1x_left, c1y_left, c1x_right, c1y_right = (
|
| 505 |
+
get_normal_points(c1x, c1y, cos_t1, sin_t1, width)
|
| 506 |
+
)
|
| 507 |
+
c2x_left, c2y_left, c2x_right, c2y_right = (
|
| 508 |
+
get_normal_points(c2x, c2y, cos_t2, sin_t2, width)
|
| 509 |
+
)
|
| 510 |
+
|
| 511 |
+
# find cm_left which is the intersecting point of a line through
|
| 512 |
+
# c1_left with angle t1 and a line through c2_left with angle
|
| 513 |
+
# t2. Same with cm_right.
|
| 514 |
+
try:
|
| 515 |
+
cmx_left, cmy_left = get_intersection(c1x_left, c1y_left, cos_t1,
|
| 516 |
+
sin_t1, c2x_left, c2y_left,
|
| 517 |
+
cos_t2, sin_t2)
|
| 518 |
+
cmx_right, cmy_right = get_intersection(c1x_right, c1y_right, cos_t1,
|
| 519 |
+
sin_t1, c2x_right, c2y_right,
|
| 520 |
+
cos_t2, sin_t2)
|
| 521 |
+
except ValueError:
|
| 522 |
+
# Special case straight lines, i.e., angle between two lines is
|
| 523 |
+
# less than the threshold used by get_intersection (we don't use
|
| 524 |
+
# check_if_parallel as the threshold is not the same).
|
| 525 |
+
cmx_left, cmy_left = (
|
| 526 |
+
0.5 * (c1x_left + c2x_left), 0.5 * (c1y_left + c2y_left)
|
| 527 |
+
)
|
| 528 |
+
cmx_right, cmy_right = (
|
| 529 |
+
0.5 * (c1x_right + c2x_right), 0.5 * (c1y_right + c2y_right)
|
| 530 |
+
)
|
| 531 |
+
|
| 532 |
+
# the parallel Bezier lines are created with control points of
|
| 533 |
+
# [c1_left, cm_left, c2_left] and [c1_right, cm_right, c2_right]
|
| 534 |
+
path_left = [(c1x_left, c1y_left),
|
| 535 |
+
(cmx_left, cmy_left),
|
| 536 |
+
(c2x_left, c2y_left)]
|
| 537 |
+
path_right = [(c1x_right, c1y_right),
|
| 538 |
+
(cmx_right, cmy_right),
|
| 539 |
+
(c2x_right, c2y_right)]
|
| 540 |
+
|
| 541 |
+
return path_left, path_right
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
|
| 545 |
+
"""
|
| 546 |
+
Find control points of the Bézier curve passing through (*c1x*, *c1y*),
|
| 547 |
+
(*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
|
| 548 |
+
"""
|
| 549 |
+
cmx = .5 * (4 * mmx - (c1x + c2x))
|
| 550 |
+
cmy = .5 * (4 * mmy - (c1y + c2y))
|
| 551 |
+
return [(c1x, c1y), (cmx, cmy), (c2x, c2y)]
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
|
| 555 |
+
"""
|
| 556 |
+
Being similar to `get_parallels`, returns control points of two quadratic
|
| 557 |
+
Bézier lines having a width roughly parallel to given one separated by
|
| 558 |
+
*width*.
|
| 559 |
+
"""
|
| 560 |
+
|
| 561 |
+
# c1, cm, c2
|
| 562 |
+
c1x, c1y = bezier2[0]
|
| 563 |
+
cmx, cmy = bezier2[1]
|
| 564 |
+
c3x, c3y = bezier2[2]
|
| 565 |
+
|
| 566 |
+
# t1 and t2 is the angle between c1 and cm, cm, c3.
|
| 567 |
+
# They are also an angle of the tangential line of the path at c1 and c3
|
| 568 |
+
cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
|
| 569 |
+
cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c3x, c3y)
|
| 570 |
+
|
| 571 |
+
# find c1_left, c1_right which are located along the lines
|
| 572 |
+
# through c1 and perpendicular to the tangential lines of the
|
| 573 |
+
# Bezier path at a distance of width. Same thing for c3_left and
|
| 574 |
+
# c3_right with respect to c3.
|
| 575 |
+
c1x_left, c1y_left, c1x_right, c1y_right = (
|
| 576 |
+
get_normal_points(c1x, c1y, cos_t1, sin_t1, width * w1)
|
| 577 |
+
)
|
| 578 |
+
c3x_left, c3y_left, c3x_right, c3y_right = (
|
| 579 |
+
get_normal_points(c3x, c3y, cos_t2, sin_t2, width * w2)
|
| 580 |
+
)
|
| 581 |
+
|
| 582 |
+
# find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and
|
| 583 |
+
# c12-c23
|
| 584 |
+
c12x, c12y = (c1x + cmx) * .5, (c1y + cmy) * .5
|
| 585 |
+
c23x, c23y = (cmx + c3x) * .5, (cmy + c3y) * .5
|
| 586 |
+
c123x, c123y = (c12x + c23x) * .5, (c12y + c23y) * .5
|
| 587 |
+
|
| 588 |
+
# tangential angle of c123 (angle between c12 and c23)
|
| 589 |
+
cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
|
| 590 |
+
|
| 591 |
+
c123x_left, c123y_left, c123x_right, c123y_right = (
|
| 592 |
+
get_normal_points(c123x, c123y, cos_t123, sin_t123, width * wm)
|
| 593 |
+
)
|
| 594 |
+
|
| 595 |
+
path_left = find_control_points(c1x_left, c1y_left,
|
| 596 |
+
c123x_left, c123y_left,
|
| 597 |
+
c3x_left, c3y_left)
|
| 598 |
+
path_right = find_control_points(c1x_right, c1y_right,
|
| 599 |
+
c123x_right, c123y_right,
|
| 600 |
+
c3x_right, c3y_right)
|
| 601 |
+
|
| 602 |
+
return path_left, path_right
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/bezier.pyi
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable
|
| 2 |
+
from typing import Literal
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
from numpy.typing import ArrayLike
|
| 6 |
+
|
| 7 |
+
from .path import Path
|
| 8 |
+
|
| 9 |
+
class NonIntersectingPathException(ValueError): ...
|
| 10 |
+
|
| 11 |
+
def get_intersection(
|
| 12 |
+
cx1: float,
|
| 13 |
+
cy1: float,
|
| 14 |
+
cos_t1: float,
|
| 15 |
+
sin_t1: float,
|
| 16 |
+
cx2: float,
|
| 17 |
+
cy2: float,
|
| 18 |
+
cos_t2: float,
|
| 19 |
+
sin_t2: float,
|
| 20 |
+
) -> tuple[float, float]: ...
|
| 21 |
+
def get_normal_points(
|
| 22 |
+
cx: float, cy: float, cos_t: float, sin_t: float, length: float
|
| 23 |
+
) -> tuple[float, float, float, float]: ...
|
| 24 |
+
def split_de_casteljau(beta: ArrayLike, t: float) -> tuple[np.ndarray, np.ndarray]: ...
|
| 25 |
+
def find_bezier_t_intersecting_with_closedpath(
|
| 26 |
+
bezier_point_at_t: Callable[[float], tuple[float, float]],
|
| 27 |
+
inside_closedpath: Callable[[tuple[float, float]], bool],
|
| 28 |
+
t0: float = ...,
|
| 29 |
+
t1: float = ...,
|
| 30 |
+
tolerance: float = ...,
|
| 31 |
+
) -> tuple[float, float]: ...
|
| 32 |
+
|
| 33 |
+
# TODO make generic over d, the dimension? ndarraydim
|
| 34 |
+
class BezierSegment:
|
| 35 |
+
def __init__(self, control_points: ArrayLike) -> None: ...
|
| 36 |
+
def __call__(self, t: ArrayLike) -> np.ndarray: ...
|
| 37 |
+
def point_at_t(self, t: float) -> tuple[float, ...]: ...
|
| 38 |
+
@property
|
| 39 |
+
def control_points(self) -> np.ndarray: ...
|
| 40 |
+
@property
|
| 41 |
+
def dimension(self) -> int: ...
|
| 42 |
+
@property
|
| 43 |
+
def degree(self) -> int: ...
|
| 44 |
+
@property
|
| 45 |
+
def polynomial_coefficients(self) -> np.ndarray: ...
|
| 46 |
+
def axis_aligned_extrema(self) -> tuple[np.ndarray, np.ndarray]: ...
|
| 47 |
+
|
| 48 |
+
def split_bezier_intersecting_with_closedpath(
|
| 49 |
+
bezier: ArrayLike,
|
| 50 |
+
inside_closedpath: Callable[[tuple[float, float]], bool],
|
| 51 |
+
tolerance: float = ...,
|
| 52 |
+
) -> tuple[np.ndarray, np.ndarray]: ...
|
| 53 |
+
def split_path_inout(
|
| 54 |
+
path: Path,
|
| 55 |
+
inside: Callable[[tuple[float, float]], bool],
|
| 56 |
+
tolerance: float = ...,
|
| 57 |
+
reorder_inout: bool = ...,
|
| 58 |
+
) -> tuple[Path, Path]: ...
|
| 59 |
+
def inside_circle(
|
| 60 |
+
cx: float, cy: float, r: float
|
| 61 |
+
) -> Callable[[tuple[float, float]], bool]: ...
|
| 62 |
+
def get_cos_sin(x0: float, y0: float, x1: float, y1: float) -> tuple[float, float]: ...
|
| 63 |
+
def check_if_parallel(
|
| 64 |
+
dx1: float, dy1: float, dx2: float, dy2: float, tolerance: float = ...
|
| 65 |
+
) -> Literal[-1, False, 1]: ...
|
| 66 |
+
def get_parallels(
|
| 67 |
+
bezier2: ArrayLike, width: float
|
| 68 |
+
) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...
|
| 69 |
+
def find_control_points(
|
| 70 |
+
c1x: float, c1y: float, mmx: float, mmy: float, c2x: float, c2y: float
|
| 71 |
+
) -> list[tuple[float, float]]: ...
|
| 72 |
+
def make_wedged_bezier2(
|
| 73 |
+
bezier2: ArrayLike, width: float, w1: float = ..., wm: float = ..., w2: float = ...
|
| 74 |
+
) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/category.py
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
|
| 3 |
+
plot three points with x-axis values of 'd', 'f', 'a'.
|
| 4 |
+
|
| 5 |
+
See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
|
| 6 |
+
example.
|
| 7 |
+
|
| 8 |
+
The module uses Matplotlib's `matplotlib.units` mechanism to convert from
|
| 9 |
+
strings to integers and provides a tick locator, a tick formatter, and the
|
| 10 |
+
`.UnitData` class that creates and stores the string-to-integer mapping.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from collections import OrderedDict
|
| 14 |
+
import dateutil.parser
|
| 15 |
+
import itertools
|
| 16 |
+
import logging
|
| 17 |
+
|
| 18 |
+
import numpy as np
|
| 19 |
+
|
| 20 |
+
from matplotlib import _api, cbook, ticker, units
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
_log = logging.getLogger(__name__)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class StrCategoryConverter(units.ConversionInterface):
|
| 27 |
+
@staticmethod
|
| 28 |
+
def convert(value, unit, axis):
|
| 29 |
+
"""
|
| 30 |
+
Convert strings in *value* to floats using mapping information stored
|
| 31 |
+
in the *unit* object.
|
| 32 |
+
|
| 33 |
+
Parameters
|
| 34 |
+
----------
|
| 35 |
+
value : str or iterable
|
| 36 |
+
Value or list of values to be converted.
|
| 37 |
+
unit : `.UnitData`
|
| 38 |
+
An object mapping strings to integers.
|
| 39 |
+
axis : `~matplotlib.axis.Axis`
|
| 40 |
+
The axis on which the converted value is plotted.
|
| 41 |
+
|
| 42 |
+
.. note:: *axis* is unused.
|
| 43 |
+
|
| 44 |
+
Returns
|
| 45 |
+
-------
|
| 46 |
+
float or `~numpy.ndarray` of float
|
| 47 |
+
"""
|
| 48 |
+
if unit is None:
|
| 49 |
+
raise ValueError(
|
| 50 |
+
'Missing category information for StrCategoryConverter; '
|
| 51 |
+
'this might be caused by unintendedly mixing categorical and '
|
| 52 |
+
'numeric data')
|
| 53 |
+
StrCategoryConverter._validate_unit(unit)
|
| 54 |
+
# dtype = object preserves numerical pass throughs
|
| 55 |
+
values = np.atleast_1d(np.array(value, dtype=object))
|
| 56 |
+
# force an update so it also does type checking
|
| 57 |
+
unit.update(values)
|
| 58 |
+
s = np.vectorize(unit._mapping.__getitem__, otypes=[float])(values)
|
| 59 |
+
return s if not cbook.is_scalar_or_string(value) else s[0]
|
| 60 |
+
|
| 61 |
+
@staticmethod
|
| 62 |
+
def axisinfo(unit, axis):
|
| 63 |
+
"""
|
| 64 |
+
Set the default axis ticks and labels.
|
| 65 |
+
|
| 66 |
+
Parameters
|
| 67 |
+
----------
|
| 68 |
+
unit : `.UnitData`
|
| 69 |
+
object string unit information for value
|
| 70 |
+
axis : `~matplotlib.axis.Axis`
|
| 71 |
+
axis for which information is being set
|
| 72 |
+
|
| 73 |
+
.. note:: *axis* is not used
|
| 74 |
+
|
| 75 |
+
Returns
|
| 76 |
+
-------
|
| 77 |
+
`~matplotlib.units.AxisInfo`
|
| 78 |
+
Information to support default tick labeling
|
| 79 |
+
|
| 80 |
+
"""
|
| 81 |
+
StrCategoryConverter._validate_unit(unit)
|
| 82 |
+
# locator and formatter take mapping dict because
|
| 83 |
+
# args need to be pass by reference for updates
|
| 84 |
+
majloc = StrCategoryLocator(unit._mapping)
|
| 85 |
+
majfmt = StrCategoryFormatter(unit._mapping)
|
| 86 |
+
return units.AxisInfo(majloc=majloc, majfmt=majfmt)
|
| 87 |
+
|
| 88 |
+
@staticmethod
|
| 89 |
+
def default_units(data, axis):
|
| 90 |
+
"""
|
| 91 |
+
Set and update the `~matplotlib.axis.Axis` units.
|
| 92 |
+
|
| 93 |
+
Parameters
|
| 94 |
+
----------
|
| 95 |
+
data : str or iterable of str
|
| 96 |
+
axis : `~matplotlib.axis.Axis`
|
| 97 |
+
axis on which the data is plotted
|
| 98 |
+
|
| 99 |
+
Returns
|
| 100 |
+
-------
|
| 101 |
+
`.UnitData`
|
| 102 |
+
object storing string to integer mapping
|
| 103 |
+
"""
|
| 104 |
+
# the conversion call stack is default_units -> axis_info -> convert
|
| 105 |
+
if axis.units is None:
|
| 106 |
+
axis.set_units(UnitData(data))
|
| 107 |
+
else:
|
| 108 |
+
axis.units.update(data)
|
| 109 |
+
return axis.units
|
| 110 |
+
|
| 111 |
+
@staticmethod
|
| 112 |
+
def _validate_unit(unit):
|
| 113 |
+
if not hasattr(unit, '_mapping'):
|
| 114 |
+
raise ValueError(
|
| 115 |
+
f'Provided unit "{unit}" is not valid for a categorical '
|
| 116 |
+
'converter, as it does not have a _mapping attribute.')
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class StrCategoryLocator(ticker.Locator):
|
| 120 |
+
"""Tick at every integer mapping of the string data."""
|
| 121 |
+
def __init__(self, units_mapping):
|
| 122 |
+
"""
|
| 123 |
+
Parameters
|
| 124 |
+
----------
|
| 125 |
+
units_mapping : dict
|
| 126 |
+
Mapping of category names (str) to indices (int).
|
| 127 |
+
"""
|
| 128 |
+
self._units = units_mapping
|
| 129 |
+
|
| 130 |
+
def __call__(self):
|
| 131 |
+
# docstring inherited
|
| 132 |
+
return list(self._units.values())
|
| 133 |
+
|
| 134 |
+
def tick_values(self, vmin, vmax):
|
| 135 |
+
# docstring inherited
|
| 136 |
+
return self()
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class StrCategoryFormatter(ticker.Formatter):
|
| 140 |
+
"""String representation of the data at every tick."""
|
| 141 |
+
def __init__(self, units_mapping):
|
| 142 |
+
"""
|
| 143 |
+
Parameters
|
| 144 |
+
----------
|
| 145 |
+
units_mapping : dict
|
| 146 |
+
Mapping of category names (str) to indices (int).
|
| 147 |
+
"""
|
| 148 |
+
self._units = units_mapping
|
| 149 |
+
|
| 150 |
+
def __call__(self, x, pos=None):
|
| 151 |
+
# docstring inherited
|
| 152 |
+
return self.format_ticks([x])[0]
|
| 153 |
+
|
| 154 |
+
def format_ticks(self, values):
|
| 155 |
+
# docstring inherited
|
| 156 |
+
r_mapping = {v: self._text(k) for k, v in self._units.items()}
|
| 157 |
+
return [r_mapping.get(round(val), '') for val in values]
|
| 158 |
+
|
| 159 |
+
@staticmethod
|
| 160 |
+
def _text(value):
|
| 161 |
+
"""Convert text values into utf-8 or ascii strings."""
|
| 162 |
+
if isinstance(value, bytes):
|
| 163 |
+
value = value.decode(encoding='utf-8')
|
| 164 |
+
elif not isinstance(value, str):
|
| 165 |
+
value = str(value)
|
| 166 |
+
return value
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class UnitData:
|
| 170 |
+
def __init__(self, data=None):
|
| 171 |
+
"""
|
| 172 |
+
Create mapping between unique categorical values and integer ids.
|
| 173 |
+
|
| 174 |
+
Parameters
|
| 175 |
+
----------
|
| 176 |
+
data : iterable
|
| 177 |
+
sequence of string values
|
| 178 |
+
"""
|
| 179 |
+
self._mapping = OrderedDict()
|
| 180 |
+
self._counter = itertools.count()
|
| 181 |
+
if data is not None:
|
| 182 |
+
self.update(data)
|
| 183 |
+
|
| 184 |
+
@staticmethod
|
| 185 |
+
def _str_is_convertible(val):
|
| 186 |
+
"""
|
| 187 |
+
Helper method to check whether a string can be parsed as float or date.
|
| 188 |
+
"""
|
| 189 |
+
try:
|
| 190 |
+
float(val)
|
| 191 |
+
except ValueError:
|
| 192 |
+
try:
|
| 193 |
+
dateutil.parser.parse(val)
|
| 194 |
+
except (ValueError, TypeError):
|
| 195 |
+
# TypeError if dateutil >= 2.8.1 else ValueError
|
| 196 |
+
return False
|
| 197 |
+
return True
|
| 198 |
+
|
| 199 |
+
def update(self, data):
|
| 200 |
+
"""
|
| 201 |
+
Map new values to integer identifiers.
|
| 202 |
+
|
| 203 |
+
Parameters
|
| 204 |
+
----------
|
| 205 |
+
data : iterable of str or bytes
|
| 206 |
+
|
| 207 |
+
Raises
|
| 208 |
+
------
|
| 209 |
+
TypeError
|
| 210 |
+
If elements in *data* are neither str nor bytes.
|
| 211 |
+
"""
|
| 212 |
+
data = np.atleast_1d(np.array(data, dtype=object))
|
| 213 |
+
# check if convertible to number:
|
| 214 |
+
convertible = True
|
| 215 |
+
for val in OrderedDict.fromkeys(data):
|
| 216 |
+
# OrderedDict just iterates over unique values in data.
|
| 217 |
+
_api.check_isinstance((str, bytes), value=val)
|
| 218 |
+
if convertible:
|
| 219 |
+
# this will only be called so long as convertible is True.
|
| 220 |
+
convertible = self._str_is_convertible(val)
|
| 221 |
+
if val not in self._mapping:
|
| 222 |
+
self._mapping[val] = next(self._counter)
|
| 223 |
+
if data.size and convertible:
|
| 224 |
+
_log.info('Using categorical units to plot a list of strings '
|
| 225 |
+
'that are all parsable as floats or dates. If these '
|
| 226 |
+
'strings should be plotted as numbers, cast to the '
|
| 227 |
+
'appropriate data type before plotting.')
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
# Register the converter with Matplotlib's unit framework
|
| 231 |
+
# Intentionally set to a single instance
|
| 232 |
+
units.registry[str] = \
|
| 233 |
+
units.registry[np.str_] = \
|
| 234 |
+
units.registry[bytes] = \
|
| 235 |
+
units.registry[np.bytes_] = StrCategoryConverter()
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/cbook.py
ADDED
|
@@ -0,0 +1,2419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A collection of utility functions and classes. Originally, many
|
| 3 |
+
(but not all) were from the Python Cookbook -- hence the name cbook.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import collections
|
| 7 |
+
import collections.abc
|
| 8 |
+
import contextlib
|
| 9 |
+
import functools
|
| 10 |
+
import gzip
|
| 11 |
+
import itertools
|
| 12 |
+
import math
|
| 13 |
+
import operator
|
| 14 |
+
import os
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
import shlex
|
| 17 |
+
import subprocess
|
| 18 |
+
import sys
|
| 19 |
+
import time
|
| 20 |
+
import traceback
|
| 21 |
+
import types
|
| 22 |
+
import weakref
|
| 23 |
+
|
| 24 |
+
import numpy as np
|
| 25 |
+
|
| 26 |
+
try:
|
| 27 |
+
from numpy.exceptions import VisibleDeprecationWarning # numpy >= 1.25
|
| 28 |
+
except ImportError:
|
| 29 |
+
from numpy import VisibleDeprecationWarning
|
| 30 |
+
|
| 31 |
+
import matplotlib
|
| 32 |
+
from matplotlib import _api, _c_internal_utils
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class _ExceptionInfo:
|
| 36 |
+
"""
|
| 37 |
+
A class to carry exception information around.
|
| 38 |
+
|
| 39 |
+
This is used to store and later raise exceptions. It's an alternative to
|
| 40 |
+
directly storing Exception instances that circumvents traceback-related
|
| 41 |
+
issues: caching tracebacks can keep user's objects in local namespaces
|
| 42 |
+
alive indefinitely, which can lead to very surprising memory issues for
|
| 43 |
+
users and result in incorrect tracebacks.
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
def __init__(self, cls, *args):
|
| 47 |
+
self._cls = cls
|
| 48 |
+
self._args = args
|
| 49 |
+
|
| 50 |
+
@classmethod
|
| 51 |
+
def from_exception(cls, exc):
|
| 52 |
+
return cls(type(exc), *exc.args)
|
| 53 |
+
|
| 54 |
+
def to_exception(self):
|
| 55 |
+
return self._cls(*self._args)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def _get_running_interactive_framework():
|
| 59 |
+
"""
|
| 60 |
+
Return the interactive framework whose event loop is currently running, if
|
| 61 |
+
any, or "headless" if no event loop can be started, or None.
|
| 62 |
+
|
| 63 |
+
Returns
|
| 64 |
+
-------
|
| 65 |
+
Optional[str]
|
| 66 |
+
One of the following values: "qt", "gtk3", "gtk4", "wx", "tk",
|
| 67 |
+
"macosx", "headless", ``None``.
|
| 68 |
+
"""
|
| 69 |
+
# Use ``sys.modules.get(name)`` rather than ``name in sys.modules`` as
|
| 70 |
+
# entries can also have been explicitly set to None.
|
| 71 |
+
QtWidgets = (
|
| 72 |
+
sys.modules.get("PyQt6.QtWidgets")
|
| 73 |
+
or sys.modules.get("PySide6.QtWidgets")
|
| 74 |
+
or sys.modules.get("PyQt5.QtWidgets")
|
| 75 |
+
or sys.modules.get("PySide2.QtWidgets")
|
| 76 |
+
)
|
| 77 |
+
if QtWidgets and QtWidgets.QApplication.instance():
|
| 78 |
+
return "qt"
|
| 79 |
+
Gtk = sys.modules.get("gi.repository.Gtk")
|
| 80 |
+
if Gtk:
|
| 81 |
+
if Gtk.MAJOR_VERSION == 4:
|
| 82 |
+
from gi.repository import GLib
|
| 83 |
+
if GLib.main_depth():
|
| 84 |
+
return "gtk4"
|
| 85 |
+
if Gtk.MAJOR_VERSION == 3 and Gtk.main_level():
|
| 86 |
+
return "gtk3"
|
| 87 |
+
wx = sys.modules.get("wx")
|
| 88 |
+
if wx and wx.GetApp():
|
| 89 |
+
return "wx"
|
| 90 |
+
tkinter = sys.modules.get("tkinter")
|
| 91 |
+
if tkinter:
|
| 92 |
+
codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__}
|
| 93 |
+
for frame in sys._current_frames().values():
|
| 94 |
+
while frame:
|
| 95 |
+
if frame.f_code in codes:
|
| 96 |
+
return "tk"
|
| 97 |
+
frame = frame.f_back
|
| 98 |
+
# Preemptively break reference cycle between locals and the frame.
|
| 99 |
+
del frame
|
| 100 |
+
macosx = sys.modules.get("matplotlib.backends._macosx")
|
| 101 |
+
if macosx and macosx.event_loop_is_running():
|
| 102 |
+
return "macosx"
|
| 103 |
+
if not _c_internal_utils.display_is_valid():
|
| 104 |
+
return "headless"
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def _exception_printer(exc):
|
| 109 |
+
if _get_running_interactive_framework() in ["headless", None]:
|
| 110 |
+
raise exc
|
| 111 |
+
else:
|
| 112 |
+
traceback.print_exc()
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class _StrongRef:
|
| 116 |
+
"""
|
| 117 |
+
Wrapper similar to a weakref, but keeping a strong reference to the object.
|
| 118 |
+
"""
|
| 119 |
+
|
| 120 |
+
def __init__(self, obj):
|
| 121 |
+
self._obj = obj
|
| 122 |
+
|
| 123 |
+
def __call__(self):
|
| 124 |
+
return self._obj
|
| 125 |
+
|
| 126 |
+
def __eq__(self, other):
|
| 127 |
+
return isinstance(other, _StrongRef) and self._obj == other._obj
|
| 128 |
+
|
| 129 |
+
def __hash__(self):
|
| 130 |
+
return hash(self._obj)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def _weak_or_strong_ref(func, callback):
|
| 134 |
+
"""
|
| 135 |
+
Return a `WeakMethod` wrapping *func* if possible, else a `_StrongRef`.
|
| 136 |
+
"""
|
| 137 |
+
try:
|
| 138 |
+
return weakref.WeakMethod(func, callback)
|
| 139 |
+
except TypeError:
|
| 140 |
+
return _StrongRef(func)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class _UnhashDict:
|
| 144 |
+
"""
|
| 145 |
+
A minimal dict-like class that also supports unhashable keys, storing them
|
| 146 |
+
in a list of key-value pairs.
|
| 147 |
+
|
| 148 |
+
This class only implements the interface needed for `CallbackRegistry`, and
|
| 149 |
+
tries to minimize the overhead for the hashable case.
|
| 150 |
+
"""
|
| 151 |
+
|
| 152 |
+
def __init__(self, pairs):
|
| 153 |
+
self._dict = {}
|
| 154 |
+
self._pairs = []
|
| 155 |
+
for k, v in pairs:
|
| 156 |
+
self[k] = v
|
| 157 |
+
|
| 158 |
+
def __setitem__(self, key, value):
|
| 159 |
+
try:
|
| 160 |
+
self._dict[key] = value
|
| 161 |
+
except TypeError:
|
| 162 |
+
for i, (k, v) in enumerate(self._pairs):
|
| 163 |
+
if k == key:
|
| 164 |
+
self._pairs[i] = (key, value)
|
| 165 |
+
break
|
| 166 |
+
else:
|
| 167 |
+
self._pairs.append((key, value))
|
| 168 |
+
|
| 169 |
+
def __getitem__(self, key):
|
| 170 |
+
try:
|
| 171 |
+
return self._dict[key]
|
| 172 |
+
except TypeError:
|
| 173 |
+
pass
|
| 174 |
+
for k, v in self._pairs:
|
| 175 |
+
if k == key:
|
| 176 |
+
return v
|
| 177 |
+
raise KeyError(key)
|
| 178 |
+
|
| 179 |
+
def pop(self, key, *args):
|
| 180 |
+
try:
|
| 181 |
+
if key in self._dict:
|
| 182 |
+
return self._dict.pop(key)
|
| 183 |
+
except TypeError:
|
| 184 |
+
for i, (k, v) in enumerate(self._pairs):
|
| 185 |
+
if k == key:
|
| 186 |
+
del self._pairs[i]
|
| 187 |
+
return v
|
| 188 |
+
if args:
|
| 189 |
+
return args[0]
|
| 190 |
+
raise KeyError(key)
|
| 191 |
+
|
| 192 |
+
def __iter__(self):
|
| 193 |
+
yield from self._dict
|
| 194 |
+
for k, v in self._pairs:
|
| 195 |
+
yield k
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
class CallbackRegistry:
|
| 199 |
+
"""
|
| 200 |
+
Handle registering, processing, blocking, and disconnecting
|
| 201 |
+
for a set of signals and callbacks:
|
| 202 |
+
|
| 203 |
+
>>> def oneat(x):
|
| 204 |
+
... print('eat', x)
|
| 205 |
+
>>> def ondrink(x):
|
| 206 |
+
... print('drink', x)
|
| 207 |
+
|
| 208 |
+
>>> from matplotlib.cbook import CallbackRegistry
|
| 209 |
+
>>> callbacks = CallbackRegistry()
|
| 210 |
+
|
| 211 |
+
>>> id_eat = callbacks.connect('eat', oneat)
|
| 212 |
+
>>> id_drink = callbacks.connect('drink', ondrink)
|
| 213 |
+
|
| 214 |
+
>>> callbacks.process('drink', 123)
|
| 215 |
+
drink 123
|
| 216 |
+
>>> callbacks.process('eat', 456)
|
| 217 |
+
eat 456
|
| 218 |
+
>>> callbacks.process('be merry', 456) # nothing will be called
|
| 219 |
+
|
| 220 |
+
>>> callbacks.disconnect(id_eat)
|
| 221 |
+
>>> callbacks.process('eat', 456) # nothing will be called
|
| 222 |
+
|
| 223 |
+
>>> with callbacks.blocked(signal='drink'):
|
| 224 |
+
... callbacks.process('drink', 123) # nothing will be called
|
| 225 |
+
>>> callbacks.process('drink', 123)
|
| 226 |
+
drink 123
|
| 227 |
+
|
| 228 |
+
In practice, one should always disconnect all callbacks when they are
|
| 229 |
+
no longer needed to avoid dangling references (and thus memory leaks).
|
| 230 |
+
However, real code in Matplotlib rarely does so, and due to its design,
|
| 231 |
+
it is rather difficult to place this kind of code. To get around this,
|
| 232 |
+
and prevent this class of memory leaks, we instead store weak references
|
| 233 |
+
to bound methods only, so when the destination object needs to die, the
|
| 234 |
+
CallbackRegistry won't keep it alive.
|
| 235 |
+
|
| 236 |
+
Parameters
|
| 237 |
+
----------
|
| 238 |
+
exception_handler : callable, optional
|
| 239 |
+
If not None, *exception_handler* must be a function that takes an
|
| 240 |
+
`Exception` as single parameter. It gets called with any `Exception`
|
| 241 |
+
raised by the callbacks during `CallbackRegistry.process`, and may
|
| 242 |
+
either re-raise the exception or handle it in another manner.
|
| 243 |
+
|
| 244 |
+
The default handler prints the exception (with `traceback.print_exc`) if
|
| 245 |
+
an interactive event loop is running; it re-raises the exception if no
|
| 246 |
+
interactive event loop is running.
|
| 247 |
+
|
| 248 |
+
signals : list, optional
|
| 249 |
+
If not None, *signals* is a list of signals that this registry handles:
|
| 250 |
+
attempting to `process` or to `connect` to a signal not in the list
|
| 251 |
+
throws a `ValueError`. The default, None, does not restrict the
|
| 252 |
+
handled signals.
|
| 253 |
+
"""
|
| 254 |
+
|
| 255 |
+
# We maintain two mappings:
|
| 256 |
+
# callbacks: signal -> {cid -> weakref-to-callback}
|
| 257 |
+
# _func_cid_map: {(signal, weakref-to-callback) -> cid}
|
| 258 |
+
|
| 259 |
+
def __init__(self, exception_handler=_exception_printer, *, signals=None):
|
| 260 |
+
self._signals = None if signals is None else list(signals) # Copy it.
|
| 261 |
+
self.exception_handler = exception_handler
|
| 262 |
+
self.callbacks = {}
|
| 263 |
+
self._cid_gen = itertools.count()
|
| 264 |
+
self._func_cid_map = _UnhashDict([])
|
| 265 |
+
# A hidden variable that marks cids that need to be pickled.
|
| 266 |
+
self._pickled_cids = set()
|
| 267 |
+
|
| 268 |
+
def __getstate__(self):
|
| 269 |
+
return {
|
| 270 |
+
**vars(self),
|
| 271 |
+
# In general, callbacks may not be pickled, so we just drop them,
|
| 272 |
+
# unless directed otherwise by self._pickled_cids.
|
| 273 |
+
"callbacks": {s: {cid: proxy() for cid, proxy in d.items()
|
| 274 |
+
if cid in self._pickled_cids}
|
| 275 |
+
for s, d in self.callbacks.items()},
|
| 276 |
+
# It is simpler to reconstruct this from callbacks in __setstate__.
|
| 277 |
+
"_func_cid_map": None,
|
| 278 |
+
"_cid_gen": next(self._cid_gen)
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
def __setstate__(self, state):
|
| 282 |
+
cid_count = state.pop('_cid_gen')
|
| 283 |
+
vars(self).update(state)
|
| 284 |
+
self.callbacks = {
|
| 285 |
+
s: {cid: _weak_or_strong_ref(func, functools.partial(self._remove_proxy, s))
|
| 286 |
+
for cid, func in d.items()}
|
| 287 |
+
for s, d in self.callbacks.items()}
|
| 288 |
+
self._func_cid_map = _UnhashDict(
|
| 289 |
+
((s, proxy), cid)
|
| 290 |
+
for s, d in self.callbacks.items() for cid, proxy in d.items())
|
| 291 |
+
self._cid_gen = itertools.count(cid_count)
|
| 292 |
+
|
| 293 |
+
def connect(self, signal, func):
|
| 294 |
+
"""Register *func* to be called when signal *signal* is generated."""
|
| 295 |
+
if self._signals is not None:
|
| 296 |
+
_api.check_in_list(self._signals, signal=signal)
|
| 297 |
+
proxy = _weak_or_strong_ref(func, functools.partial(self._remove_proxy, signal))
|
| 298 |
+
try:
|
| 299 |
+
return self._func_cid_map[signal, proxy]
|
| 300 |
+
except KeyError:
|
| 301 |
+
cid = self._func_cid_map[signal, proxy] = next(self._cid_gen)
|
| 302 |
+
self.callbacks.setdefault(signal, {})[cid] = proxy
|
| 303 |
+
return cid
|
| 304 |
+
|
| 305 |
+
def _connect_picklable(self, signal, func):
|
| 306 |
+
"""
|
| 307 |
+
Like `.connect`, but the callback is kept when pickling/unpickling.
|
| 308 |
+
|
| 309 |
+
Currently internal-use only.
|
| 310 |
+
"""
|
| 311 |
+
cid = self.connect(signal, func)
|
| 312 |
+
self._pickled_cids.add(cid)
|
| 313 |
+
return cid
|
| 314 |
+
|
| 315 |
+
# Keep a reference to sys.is_finalizing, as sys may have been cleared out
|
| 316 |
+
# at that point.
|
| 317 |
+
def _remove_proxy(self, signal, proxy, *, _is_finalizing=sys.is_finalizing):
|
| 318 |
+
if _is_finalizing():
|
| 319 |
+
# Weakrefs can't be properly torn down at that point anymore.
|
| 320 |
+
return
|
| 321 |
+
cid = self._func_cid_map.pop((signal, proxy), None)
|
| 322 |
+
if cid is not None:
|
| 323 |
+
del self.callbacks[signal][cid]
|
| 324 |
+
self._pickled_cids.discard(cid)
|
| 325 |
+
else: # Not found
|
| 326 |
+
return
|
| 327 |
+
if len(self.callbacks[signal]) == 0: # Clean up empty dicts
|
| 328 |
+
del self.callbacks[signal]
|
| 329 |
+
|
| 330 |
+
def disconnect(self, cid):
|
| 331 |
+
"""
|
| 332 |
+
Disconnect the callback registered with callback id *cid*.
|
| 333 |
+
|
| 334 |
+
No error is raised if such a callback does not exist.
|
| 335 |
+
"""
|
| 336 |
+
self._pickled_cids.discard(cid)
|
| 337 |
+
for signal, proxy in self._func_cid_map:
|
| 338 |
+
if self._func_cid_map[signal, proxy] == cid:
|
| 339 |
+
break
|
| 340 |
+
else: # Not found
|
| 341 |
+
return
|
| 342 |
+
assert self.callbacks[signal][cid] == proxy
|
| 343 |
+
del self.callbacks[signal][cid]
|
| 344 |
+
self._func_cid_map.pop((signal, proxy))
|
| 345 |
+
if len(self.callbacks[signal]) == 0: # Clean up empty dicts
|
| 346 |
+
del self.callbacks[signal]
|
| 347 |
+
|
| 348 |
+
def process(self, s, *args, **kwargs):
|
| 349 |
+
"""
|
| 350 |
+
Process signal *s*.
|
| 351 |
+
|
| 352 |
+
All of the functions registered to receive callbacks on *s* will be
|
| 353 |
+
called with ``*args`` and ``**kwargs``.
|
| 354 |
+
"""
|
| 355 |
+
if self._signals is not None:
|
| 356 |
+
_api.check_in_list(self._signals, signal=s)
|
| 357 |
+
for ref in list(self.callbacks.get(s, {}).values()):
|
| 358 |
+
func = ref()
|
| 359 |
+
if func is not None:
|
| 360 |
+
try:
|
| 361 |
+
func(*args, **kwargs)
|
| 362 |
+
# this does not capture KeyboardInterrupt, SystemExit,
|
| 363 |
+
# and GeneratorExit
|
| 364 |
+
except Exception as exc:
|
| 365 |
+
if self.exception_handler is not None:
|
| 366 |
+
self.exception_handler(exc)
|
| 367 |
+
else:
|
| 368 |
+
raise
|
| 369 |
+
|
| 370 |
+
@contextlib.contextmanager
|
| 371 |
+
def blocked(self, *, signal=None):
|
| 372 |
+
"""
|
| 373 |
+
Block callback signals from being processed.
|
| 374 |
+
|
| 375 |
+
A context manager to temporarily block/disable callback signals
|
| 376 |
+
from being processed by the registered listeners.
|
| 377 |
+
|
| 378 |
+
Parameters
|
| 379 |
+
----------
|
| 380 |
+
signal : str, optional
|
| 381 |
+
The callback signal to block. The default is to block all signals.
|
| 382 |
+
"""
|
| 383 |
+
orig = self.callbacks
|
| 384 |
+
try:
|
| 385 |
+
if signal is None:
|
| 386 |
+
# Empty out the callbacks
|
| 387 |
+
self.callbacks = {}
|
| 388 |
+
else:
|
| 389 |
+
# Only remove the specific signal
|
| 390 |
+
self.callbacks = {k: orig[k] for k in orig if k != signal}
|
| 391 |
+
yield
|
| 392 |
+
finally:
|
| 393 |
+
self.callbacks = orig
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
class silent_list(list):
|
| 397 |
+
"""
|
| 398 |
+
A list with a short ``repr()``.
|
| 399 |
+
|
| 400 |
+
This is meant to be used for a homogeneous list of artists, so that they
|
| 401 |
+
don't cause long, meaningless output.
|
| 402 |
+
|
| 403 |
+
Instead of ::
|
| 404 |
+
|
| 405 |
+
[<matplotlib.lines.Line2D object at 0x7f5749fed3c8>,
|
| 406 |
+
<matplotlib.lines.Line2D object at 0x7f5749fed4e0>,
|
| 407 |
+
<matplotlib.lines.Line2D object at 0x7f5758016550>]
|
| 408 |
+
|
| 409 |
+
one will get ::
|
| 410 |
+
|
| 411 |
+
<a list of 3 Line2D objects>
|
| 412 |
+
|
| 413 |
+
If ``self.type`` is None, the type name is obtained from the first item in
|
| 414 |
+
the list (if any).
|
| 415 |
+
"""
|
| 416 |
+
|
| 417 |
+
def __init__(self, type, seq=None):
|
| 418 |
+
self.type = type
|
| 419 |
+
if seq is not None:
|
| 420 |
+
self.extend(seq)
|
| 421 |
+
|
| 422 |
+
def __repr__(self):
|
| 423 |
+
if self.type is not None or len(self) != 0:
|
| 424 |
+
tp = self.type if self.type is not None else type(self[0]).__name__
|
| 425 |
+
return f"<a list of {len(self)} {tp} objects>"
|
| 426 |
+
else:
|
| 427 |
+
return "<an empty list>"
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
def _local_over_kwdict(
|
| 431 |
+
local_var, kwargs, *keys,
|
| 432 |
+
warning_cls=_api.MatplotlibDeprecationWarning):
|
| 433 |
+
out = local_var
|
| 434 |
+
for key in keys:
|
| 435 |
+
kwarg_val = kwargs.pop(key, None)
|
| 436 |
+
if kwarg_val is not None:
|
| 437 |
+
if out is None:
|
| 438 |
+
out = kwarg_val
|
| 439 |
+
else:
|
| 440 |
+
_api.warn_external(f'"{key}" keyword argument will be ignored',
|
| 441 |
+
warning_cls)
|
| 442 |
+
return out
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
def strip_math(s):
|
| 446 |
+
"""
|
| 447 |
+
Remove latex formatting from mathtext.
|
| 448 |
+
|
| 449 |
+
Only handles fully math and fully non-math strings.
|
| 450 |
+
"""
|
| 451 |
+
if len(s) >= 2 and s[0] == s[-1] == "$":
|
| 452 |
+
s = s[1:-1]
|
| 453 |
+
for tex, plain in [
|
| 454 |
+
(r"\times", "x"), # Specifically for Formatter support.
|
| 455 |
+
(r"\mathdefault", ""),
|
| 456 |
+
(r"\rm", ""),
|
| 457 |
+
(r"\cal", ""),
|
| 458 |
+
(r"\tt", ""),
|
| 459 |
+
(r"\it", ""),
|
| 460 |
+
("\\", ""),
|
| 461 |
+
("{", ""),
|
| 462 |
+
("}", ""),
|
| 463 |
+
]:
|
| 464 |
+
s = s.replace(tex, plain)
|
| 465 |
+
return s
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
def _strip_comment(s):
|
| 469 |
+
"""Strip everything from the first unquoted #."""
|
| 470 |
+
pos = 0
|
| 471 |
+
while True:
|
| 472 |
+
quote_pos = s.find('"', pos)
|
| 473 |
+
hash_pos = s.find('#', pos)
|
| 474 |
+
if quote_pos < 0:
|
| 475 |
+
without_comment = s if hash_pos < 0 else s[:hash_pos]
|
| 476 |
+
return without_comment.strip()
|
| 477 |
+
elif 0 <= hash_pos < quote_pos:
|
| 478 |
+
return s[:hash_pos].strip()
|
| 479 |
+
else:
|
| 480 |
+
closing_quote_pos = s.find('"', quote_pos + 1)
|
| 481 |
+
if closing_quote_pos < 0:
|
| 482 |
+
raise ValueError(
|
| 483 |
+
f"Missing closing quote in: {s!r}. If you need a double-"
|
| 484 |
+
'quote inside a string, use escaping: e.g. "the \" char"')
|
| 485 |
+
pos = closing_quote_pos + 1 # behind closing quote
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
def is_writable_file_like(obj):
|
| 489 |
+
"""Return whether *obj* looks like a file object with a *write* method."""
|
| 490 |
+
return callable(getattr(obj, 'write', None))
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
def file_requires_unicode(x):
|
| 494 |
+
"""
|
| 495 |
+
Return whether the given writable file-like object requires Unicode to be
|
| 496 |
+
written to it.
|
| 497 |
+
"""
|
| 498 |
+
try:
|
| 499 |
+
x.write(b'')
|
| 500 |
+
except TypeError:
|
| 501 |
+
return True
|
| 502 |
+
else:
|
| 503 |
+
return False
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
|
| 507 |
+
"""
|
| 508 |
+
Convert a path to an open file handle or pass-through a file-like object.
|
| 509 |
+
|
| 510 |
+
Consider using `open_file_cm` instead, as it allows one to properly close
|
| 511 |
+
newly created file objects more easily.
|
| 512 |
+
|
| 513 |
+
Parameters
|
| 514 |
+
----------
|
| 515 |
+
fname : str or path-like or file-like
|
| 516 |
+
If `str` or `os.PathLike`, the file is opened using the flags specified
|
| 517 |
+
by *flag* and *encoding*. If a file-like object, it is passed through.
|
| 518 |
+
flag : str, default: 'r'
|
| 519 |
+
Passed as the *mode* argument to `open` when *fname* is `str` or
|
| 520 |
+
`os.PathLike`; ignored if *fname* is file-like.
|
| 521 |
+
return_opened : bool, default: False
|
| 522 |
+
If True, return both the file object and a boolean indicating whether
|
| 523 |
+
this was a new file (that the caller needs to close). If False, return
|
| 524 |
+
only the new file.
|
| 525 |
+
encoding : str or None, default: None
|
| 526 |
+
Passed as the *mode* argument to `open` when *fname* is `str` or
|
| 527 |
+
`os.PathLike`; ignored if *fname* is file-like.
|
| 528 |
+
|
| 529 |
+
Returns
|
| 530 |
+
-------
|
| 531 |
+
fh : file-like
|
| 532 |
+
opened : bool
|
| 533 |
+
*opened* is only returned if *return_opened* is True.
|
| 534 |
+
"""
|
| 535 |
+
if isinstance(fname, os.PathLike):
|
| 536 |
+
fname = os.fspath(fname)
|
| 537 |
+
if isinstance(fname, str):
|
| 538 |
+
if fname.endswith('.gz'):
|
| 539 |
+
fh = gzip.open(fname, flag)
|
| 540 |
+
elif fname.endswith('.bz2'):
|
| 541 |
+
# python may not be compiled with bz2 support,
|
| 542 |
+
# bury import until we need it
|
| 543 |
+
import bz2
|
| 544 |
+
fh = bz2.BZ2File(fname, flag)
|
| 545 |
+
else:
|
| 546 |
+
fh = open(fname, flag, encoding=encoding)
|
| 547 |
+
opened = True
|
| 548 |
+
elif hasattr(fname, 'seek'):
|
| 549 |
+
fh = fname
|
| 550 |
+
opened = False
|
| 551 |
+
else:
|
| 552 |
+
raise ValueError('fname must be a PathLike or file handle')
|
| 553 |
+
if return_opened:
|
| 554 |
+
return fh, opened
|
| 555 |
+
return fh
|
| 556 |
+
|
| 557 |
+
|
| 558 |
+
def open_file_cm(path_or_file, mode="r", encoding=None):
|
| 559 |
+
r"""Pass through file objects and context-manage path-likes."""
|
| 560 |
+
fh, opened = to_filehandle(path_or_file, mode, True, encoding)
|
| 561 |
+
return fh if opened else contextlib.nullcontext(fh)
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
def is_scalar_or_string(val):
|
| 565 |
+
"""Return whether the given object is a scalar or string like."""
|
| 566 |
+
return isinstance(val, str) or not np.iterable(val)
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
def get_sample_data(fname, asfileobj=True):
|
| 570 |
+
"""
|
| 571 |
+
Return a sample data file. *fname* is a path relative to the
|
| 572 |
+
:file:`mpl-data/sample_data` directory. If *asfileobj* is `True`
|
| 573 |
+
return a file object, otherwise just a file path.
|
| 574 |
+
|
| 575 |
+
Sample data files are stored in the 'mpl-data/sample_data' directory within
|
| 576 |
+
the Matplotlib package.
|
| 577 |
+
|
| 578 |
+
If the filename ends in .gz, the file is implicitly ungzipped. If the
|
| 579 |
+
filename ends with .npy or .npz, and *asfileobj* is `True`, the file is
|
| 580 |
+
loaded with `numpy.load`.
|
| 581 |
+
"""
|
| 582 |
+
path = _get_data_path('sample_data', fname)
|
| 583 |
+
if asfileobj:
|
| 584 |
+
suffix = path.suffix.lower()
|
| 585 |
+
if suffix == '.gz':
|
| 586 |
+
return gzip.open(path)
|
| 587 |
+
elif suffix in ['.npy', '.npz']:
|
| 588 |
+
return np.load(path)
|
| 589 |
+
elif suffix in ['.csv', '.xrc', '.txt']:
|
| 590 |
+
return path.open('r')
|
| 591 |
+
else:
|
| 592 |
+
return path.open('rb')
|
| 593 |
+
else:
|
| 594 |
+
return str(path)
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
def _get_data_path(*args):
|
| 598 |
+
"""
|
| 599 |
+
Return the `pathlib.Path` to a resource file provided by Matplotlib.
|
| 600 |
+
|
| 601 |
+
``*args`` specify a path relative to the base data path.
|
| 602 |
+
"""
|
| 603 |
+
return Path(matplotlib.get_data_path(), *args)
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
def flatten(seq, scalarp=is_scalar_or_string):
|
| 607 |
+
"""
|
| 608 |
+
Return a generator of flattened nested containers.
|
| 609 |
+
|
| 610 |
+
For example:
|
| 611 |
+
|
| 612 |
+
>>> from matplotlib.cbook import flatten
|
| 613 |
+
>>> l = (('John', ['Hunter']), (1, 23), [[([42, (5, 23)], )]])
|
| 614 |
+
>>> print(list(flatten(l)))
|
| 615 |
+
['John', 'Hunter', 1, 23, 42, 5, 23]
|
| 616 |
+
|
| 617 |
+
By: Composite of Holger Krekel and Luther Blissett
|
| 618 |
+
From: https://code.activestate.com/recipes/121294-simple-generator-for-flattening-nested-containers/
|
| 619 |
+
and Recipe 1.12 in cookbook
|
| 620 |
+
""" # noqa: E501
|
| 621 |
+
for item in seq:
|
| 622 |
+
if scalarp(item) or item is None:
|
| 623 |
+
yield item
|
| 624 |
+
else:
|
| 625 |
+
yield from flatten(item, scalarp)
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
class _Stack:
|
| 629 |
+
"""
|
| 630 |
+
Stack of elements with a movable cursor.
|
| 631 |
+
|
| 632 |
+
Mimics home/back/forward in a web browser.
|
| 633 |
+
"""
|
| 634 |
+
|
| 635 |
+
def __init__(self):
|
| 636 |
+
self._pos = -1
|
| 637 |
+
self._elements = []
|
| 638 |
+
|
| 639 |
+
def clear(self):
|
| 640 |
+
"""Empty the stack."""
|
| 641 |
+
self._pos = -1
|
| 642 |
+
self._elements = []
|
| 643 |
+
|
| 644 |
+
def __call__(self):
|
| 645 |
+
"""Return the current element, or None."""
|
| 646 |
+
return self._elements[self._pos] if self._elements else None
|
| 647 |
+
|
| 648 |
+
def __len__(self):
|
| 649 |
+
return len(self._elements)
|
| 650 |
+
|
| 651 |
+
def __getitem__(self, ind):
|
| 652 |
+
return self._elements[ind]
|
| 653 |
+
|
| 654 |
+
def forward(self):
|
| 655 |
+
"""Move the position forward and return the current element."""
|
| 656 |
+
self._pos = min(self._pos + 1, len(self._elements) - 1)
|
| 657 |
+
return self()
|
| 658 |
+
|
| 659 |
+
def back(self):
|
| 660 |
+
"""Move the position back and return the current element."""
|
| 661 |
+
self._pos = max(self._pos - 1, 0)
|
| 662 |
+
return self()
|
| 663 |
+
|
| 664 |
+
def push(self, o):
|
| 665 |
+
"""
|
| 666 |
+
Push *o* to the stack after the current position, and return *o*.
|
| 667 |
+
|
| 668 |
+
Discard all later elements.
|
| 669 |
+
"""
|
| 670 |
+
self._elements[self._pos + 1:] = [o]
|
| 671 |
+
self._pos = len(self._elements) - 1
|
| 672 |
+
return o
|
| 673 |
+
|
| 674 |
+
def home(self):
|
| 675 |
+
"""
|
| 676 |
+
Push the first element onto the top of the stack.
|
| 677 |
+
|
| 678 |
+
The first element is returned.
|
| 679 |
+
"""
|
| 680 |
+
return self.push(self._elements[0]) if self._elements else None
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
def safe_masked_invalid(x, copy=False):
|
| 684 |
+
x = np.array(x, subok=True, copy=copy)
|
| 685 |
+
if not x.dtype.isnative:
|
| 686 |
+
# If we have already made a copy, do the byteswap in place, else make a
|
| 687 |
+
# copy with the byte order swapped.
|
| 688 |
+
# Swap to native order.
|
| 689 |
+
x = x.byteswap(inplace=copy).view(x.dtype.newbyteorder('N'))
|
| 690 |
+
try:
|
| 691 |
+
xm = np.ma.masked_where(~(np.isfinite(x)), x, copy=False)
|
| 692 |
+
except TypeError:
|
| 693 |
+
return x
|
| 694 |
+
return xm
|
| 695 |
+
|
| 696 |
+
|
| 697 |
+
def print_cycles(objects, outstream=sys.stdout, show_progress=False):
|
| 698 |
+
"""
|
| 699 |
+
Print loops of cyclic references in the given *objects*.
|
| 700 |
+
|
| 701 |
+
It is often useful to pass in ``gc.garbage`` to find the cycles that are
|
| 702 |
+
preventing some objects from being garbage collected.
|
| 703 |
+
|
| 704 |
+
Parameters
|
| 705 |
+
----------
|
| 706 |
+
objects
|
| 707 |
+
A list of objects to find cycles in.
|
| 708 |
+
outstream
|
| 709 |
+
The stream for output.
|
| 710 |
+
show_progress : bool
|
| 711 |
+
If True, print the number of objects reached as they are found.
|
| 712 |
+
"""
|
| 713 |
+
import gc
|
| 714 |
+
|
| 715 |
+
def print_path(path):
|
| 716 |
+
for i, step in enumerate(path):
|
| 717 |
+
# next "wraps around"
|
| 718 |
+
next = path[(i + 1) % len(path)]
|
| 719 |
+
|
| 720 |
+
outstream.write(" %s -- " % type(step))
|
| 721 |
+
if isinstance(step, dict):
|
| 722 |
+
for key, val in step.items():
|
| 723 |
+
if val is next:
|
| 724 |
+
outstream.write(f"[{key!r}]")
|
| 725 |
+
break
|
| 726 |
+
if key is next:
|
| 727 |
+
outstream.write(f"[key] = {val!r}")
|
| 728 |
+
break
|
| 729 |
+
elif isinstance(step, list):
|
| 730 |
+
outstream.write("[%d]" % step.index(next))
|
| 731 |
+
elif isinstance(step, tuple):
|
| 732 |
+
outstream.write("( tuple )")
|
| 733 |
+
else:
|
| 734 |
+
outstream.write(repr(step))
|
| 735 |
+
outstream.write(" ->\n")
|
| 736 |
+
outstream.write("\n")
|
| 737 |
+
|
| 738 |
+
def recurse(obj, start, all, current_path):
|
| 739 |
+
if show_progress:
|
| 740 |
+
outstream.write("%d\r" % len(all))
|
| 741 |
+
|
| 742 |
+
all[id(obj)] = None
|
| 743 |
+
|
| 744 |
+
referents = gc.get_referents(obj)
|
| 745 |
+
for referent in referents:
|
| 746 |
+
# If we've found our way back to the start, this is
|
| 747 |
+
# a cycle, so print it out
|
| 748 |
+
if referent is start:
|
| 749 |
+
print_path(current_path)
|
| 750 |
+
|
| 751 |
+
# Don't go back through the original list of objects, or
|
| 752 |
+
# through temporary references to the object, since those
|
| 753 |
+
# are just an artifact of the cycle detector itself.
|
| 754 |
+
elif referent is objects or isinstance(referent, types.FrameType):
|
| 755 |
+
continue
|
| 756 |
+
|
| 757 |
+
# We haven't seen this object before, so recurse
|
| 758 |
+
elif id(referent) not in all:
|
| 759 |
+
recurse(referent, start, all, current_path + [obj])
|
| 760 |
+
|
| 761 |
+
for obj in objects:
|
| 762 |
+
outstream.write(f"Examining: {obj!r}\n")
|
| 763 |
+
recurse(obj, obj, {}, [])
|
| 764 |
+
|
| 765 |
+
|
| 766 |
+
class Grouper:
|
| 767 |
+
"""
|
| 768 |
+
A disjoint-set data structure.
|
| 769 |
+
|
| 770 |
+
Objects can be joined using :meth:`join`, tested for connectedness
|
| 771 |
+
using :meth:`joined`, and all disjoint sets can be retrieved by
|
| 772 |
+
using the object as an iterator.
|
| 773 |
+
|
| 774 |
+
The objects being joined must be hashable and weak-referenceable.
|
| 775 |
+
|
| 776 |
+
Examples
|
| 777 |
+
--------
|
| 778 |
+
>>> from matplotlib.cbook import Grouper
|
| 779 |
+
>>> class Foo:
|
| 780 |
+
... def __init__(self, s):
|
| 781 |
+
... self.s = s
|
| 782 |
+
... def __repr__(self):
|
| 783 |
+
... return self.s
|
| 784 |
+
...
|
| 785 |
+
>>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef']
|
| 786 |
+
>>> grp = Grouper()
|
| 787 |
+
>>> grp.join(a, b)
|
| 788 |
+
>>> grp.join(b, c)
|
| 789 |
+
>>> grp.join(d, e)
|
| 790 |
+
>>> list(grp)
|
| 791 |
+
[[a, b, c], [d, e]]
|
| 792 |
+
>>> grp.joined(a, b)
|
| 793 |
+
True
|
| 794 |
+
>>> grp.joined(a, c)
|
| 795 |
+
True
|
| 796 |
+
>>> grp.joined(a, d)
|
| 797 |
+
False
|
| 798 |
+
"""
|
| 799 |
+
|
| 800 |
+
def __init__(self, init=()):
|
| 801 |
+
self._mapping = weakref.WeakKeyDictionary(
|
| 802 |
+
{x: weakref.WeakSet([x]) for x in init})
|
| 803 |
+
self._ordering = weakref.WeakKeyDictionary()
|
| 804 |
+
for x in init:
|
| 805 |
+
if x not in self._ordering:
|
| 806 |
+
self._ordering[x] = len(self._ordering)
|
| 807 |
+
self._next_order = len(self._ordering) # Plain int to simplify pickling.
|
| 808 |
+
|
| 809 |
+
def __getstate__(self):
|
| 810 |
+
return {
|
| 811 |
+
**vars(self),
|
| 812 |
+
# Convert weak refs to strong ones.
|
| 813 |
+
"_mapping": {k: set(v) for k, v in self._mapping.items()},
|
| 814 |
+
"_ordering": {**self._ordering},
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
def __setstate__(self, state):
|
| 818 |
+
vars(self).update(state)
|
| 819 |
+
# Convert strong refs to weak ones.
|
| 820 |
+
self._mapping = weakref.WeakKeyDictionary(
|
| 821 |
+
{k: weakref.WeakSet(v) for k, v in self._mapping.items()})
|
| 822 |
+
self._ordering = weakref.WeakKeyDictionary(self._ordering)
|
| 823 |
+
|
| 824 |
+
def __contains__(self, item):
|
| 825 |
+
return item in self._mapping
|
| 826 |
+
|
| 827 |
+
def join(self, a, *args):
|
| 828 |
+
"""
|
| 829 |
+
Join given arguments into the same set. Accepts one or more arguments.
|
| 830 |
+
"""
|
| 831 |
+
mapping = self._mapping
|
| 832 |
+
try:
|
| 833 |
+
set_a = mapping[a]
|
| 834 |
+
except KeyError:
|
| 835 |
+
set_a = mapping[a] = weakref.WeakSet([a])
|
| 836 |
+
self._ordering[a] = self._next_order
|
| 837 |
+
self._next_order += 1
|
| 838 |
+
for arg in args:
|
| 839 |
+
try:
|
| 840 |
+
set_b = mapping[arg]
|
| 841 |
+
except KeyError:
|
| 842 |
+
set_b = mapping[arg] = weakref.WeakSet([arg])
|
| 843 |
+
self._ordering[arg] = self._next_order
|
| 844 |
+
self._next_order += 1
|
| 845 |
+
if set_b is not set_a:
|
| 846 |
+
if len(set_b) > len(set_a):
|
| 847 |
+
set_a, set_b = set_b, set_a
|
| 848 |
+
set_a.update(set_b)
|
| 849 |
+
for elem in set_b:
|
| 850 |
+
mapping[elem] = set_a
|
| 851 |
+
|
| 852 |
+
def joined(self, a, b):
|
| 853 |
+
"""Return whether *a* and *b* are members of the same set."""
|
| 854 |
+
return (self._mapping.get(a, object()) is self._mapping.get(b))
|
| 855 |
+
|
| 856 |
+
def remove(self, a):
|
| 857 |
+
"""Remove *a* from the grouper, doing nothing if it is not there."""
|
| 858 |
+
self._mapping.pop(a, {a}).remove(a)
|
| 859 |
+
self._ordering.pop(a, None)
|
| 860 |
+
|
| 861 |
+
def __iter__(self):
|
| 862 |
+
"""
|
| 863 |
+
Iterate over each of the disjoint sets as a list.
|
| 864 |
+
|
| 865 |
+
The iterator is invalid if interleaved with calls to join().
|
| 866 |
+
"""
|
| 867 |
+
unique_groups = {id(group): group for group in self._mapping.values()}
|
| 868 |
+
for group in unique_groups.values():
|
| 869 |
+
yield sorted(group, key=self._ordering.__getitem__)
|
| 870 |
+
|
| 871 |
+
def get_siblings(self, a):
|
| 872 |
+
"""Return all of the items joined with *a*, including itself."""
|
| 873 |
+
siblings = self._mapping.get(a, [a])
|
| 874 |
+
return sorted(siblings, key=self._ordering.get)
|
| 875 |
+
|
| 876 |
+
|
| 877 |
+
class GrouperView:
|
| 878 |
+
"""Immutable view over a `.Grouper`."""
|
| 879 |
+
|
| 880 |
+
def __init__(self, grouper): self._grouper = grouper
|
| 881 |
+
def __contains__(self, item): return item in self._grouper
|
| 882 |
+
def __iter__(self): return iter(self._grouper)
|
| 883 |
+
|
| 884 |
+
def joined(self, a, b):
|
| 885 |
+
"""
|
| 886 |
+
Return whether *a* and *b* are members of the same set.
|
| 887 |
+
"""
|
| 888 |
+
return self._grouper.joined(a, b)
|
| 889 |
+
|
| 890 |
+
def get_siblings(self, a):
|
| 891 |
+
"""
|
| 892 |
+
Return all of the items joined with *a*, including itself.
|
| 893 |
+
"""
|
| 894 |
+
return self._grouper.get_siblings(a)
|
| 895 |
+
|
| 896 |
+
|
| 897 |
+
def simple_linear_interpolation(a, steps):
|
| 898 |
+
"""
|
| 899 |
+
Resample an array with ``steps - 1`` points between original point pairs.
|
| 900 |
+
|
| 901 |
+
Along each column of *a*, ``(steps - 1)`` points are introduced between
|
| 902 |
+
each original values; the values are linearly interpolated.
|
| 903 |
+
|
| 904 |
+
Parameters
|
| 905 |
+
----------
|
| 906 |
+
a : array, shape (n, ...)
|
| 907 |
+
steps : int
|
| 908 |
+
|
| 909 |
+
Returns
|
| 910 |
+
-------
|
| 911 |
+
array
|
| 912 |
+
shape ``((n - 1) * steps + 1, ...)``
|
| 913 |
+
"""
|
| 914 |
+
fps = a.reshape((len(a), -1))
|
| 915 |
+
xp = np.arange(len(a)) * steps
|
| 916 |
+
x = np.arange((len(a) - 1) * steps + 1)
|
| 917 |
+
return (np.column_stack([np.interp(x, xp, fp) for fp in fps.T])
|
| 918 |
+
.reshape((len(x),) + a.shape[1:]))
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
def delete_masked_points(*args):
|
| 922 |
+
"""
|
| 923 |
+
Find all masked and/or non-finite points in a set of arguments,
|
| 924 |
+
and return the arguments with only the unmasked points remaining.
|
| 925 |
+
|
| 926 |
+
Arguments can be in any of 5 categories:
|
| 927 |
+
|
| 928 |
+
1) 1-D masked arrays
|
| 929 |
+
2) 1-D ndarrays
|
| 930 |
+
3) ndarrays with more than one dimension
|
| 931 |
+
4) other non-string iterables
|
| 932 |
+
5) anything else
|
| 933 |
+
|
| 934 |
+
The first argument must be in one of the first four categories;
|
| 935 |
+
any argument with a length differing from that of the first
|
| 936 |
+
argument (and hence anything in category 5) then will be
|
| 937 |
+
passed through unchanged.
|
| 938 |
+
|
| 939 |
+
Masks are obtained from all arguments of the correct length
|
| 940 |
+
in categories 1, 2, and 4; a point is bad if masked in a masked
|
| 941 |
+
array or if it is a nan or inf. No attempt is made to
|
| 942 |
+
extract a mask from categories 2, 3, and 4 if `numpy.isfinite`
|
| 943 |
+
does not yield a Boolean array.
|
| 944 |
+
|
| 945 |
+
All input arguments that are not passed unchanged are returned
|
| 946 |
+
as ndarrays after removing the points or rows corresponding to
|
| 947 |
+
masks in any of the arguments.
|
| 948 |
+
|
| 949 |
+
A vastly simpler version of this function was originally
|
| 950 |
+
written as a helper for Axes.scatter().
|
| 951 |
+
|
| 952 |
+
"""
|
| 953 |
+
if not len(args):
|
| 954 |
+
return ()
|
| 955 |
+
if is_scalar_or_string(args[0]):
|
| 956 |
+
raise ValueError("First argument must be a sequence")
|
| 957 |
+
nrecs = len(args[0])
|
| 958 |
+
margs = []
|
| 959 |
+
seqlist = [False] * len(args)
|
| 960 |
+
for i, x in enumerate(args):
|
| 961 |
+
if not isinstance(x, str) and np.iterable(x) and len(x) == nrecs:
|
| 962 |
+
seqlist[i] = True
|
| 963 |
+
if isinstance(x, np.ma.MaskedArray):
|
| 964 |
+
if x.ndim > 1:
|
| 965 |
+
raise ValueError("Masked arrays must be 1-D")
|
| 966 |
+
else:
|
| 967 |
+
x = np.asarray(x)
|
| 968 |
+
margs.append(x)
|
| 969 |
+
masks = [] # List of masks that are True where good.
|
| 970 |
+
for i, x in enumerate(margs):
|
| 971 |
+
if seqlist[i]:
|
| 972 |
+
if x.ndim > 1:
|
| 973 |
+
continue # Don't try to get nan locations unless 1-D.
|
| 974 |
+
if isinstance(x, np.ma.MaskedArray):
|
| 975 |
+
masks.append(~np.ma.getmaskarray(x)) # invert the mask
|
| 976 |
+
xd = x.data
|
| 977 |
+
else:
|
| 978 |
+
xd = x
|
| 979 |
+
try:
|
| 980 |
+
mask = np.isfinite(xd)
|
| 981 |
+
if isinstance(mask, np.ndarray):
|
| 982 |
+
masks.append(mask)
|
| 983 |
+
except Exception: # Fixme: put in tuple of possible exceptions?
|
| 984 |
+
pass
|
| 985 |
+
if len(masks):
|
| 986 |
+
mask = np.logical_and.reduce(masks)
|
| 987 |
+
igood = mask.nonzero()[0]
|
| 988 |
+
if len(igood) < nrecs:
|
| 989 |
+
for i, x in enumerate(margs):
|
| 990 |
+
if seqlist[i]:
|
| 991 |
+
margs[i] = x[igood]
|
| 992 |
+
for i, x in enumerate(margs):
|
| 993 |
+
if seqlist[i] and isinstance(x, np.ma.MaskedArray):
|
| 994 |
+
margs[i] = x.filled()
|
| 995 |
+
return margs
|
| 996 |
+
|
| 997 |
+
|
| 998 |
+
def _combine_masks(*args):
|
| 999 |
+
"""
|
| 1000 |
+
Find all masked and/or non-finite points in a set of arguments,
|
| 1001 |
+
and return the arguments as masked arrays with a common mask.
|
| 1002 |
+
|
| 1003 |
+
Arguments can be in any of 5 categories:
|
| 1004 |
+
|
| 1005 |
+
1) 1-D masked arrays
|
| 1006 |
+
2) 1-D ndarrays
|
| 1007 |
+
3) ndarrays with more than one dimension
|
| 1008 |
+
4) other non-string iterables
|
| 1009 |
+
5) anything else
|
| 1010 |
+
|
| 1011 |
+
The first argument must be in one of the first four categories;
|
| 1012 |
+
any argument with a length differing from that of the first
|
| 1013 |
+
argument (and hence anything in category 5) then will be
|
| 1014 |
+
passed through unchanged.
|
| 1015 |
+
|
| 1016 |
+
Masks are obtained from all arguments of the correct length
|
| 1017 |
+
in categories 1, 2, and 4; a point is bad if masked in a masked
|
| 1018 |
+
array or if it is a nan or inf. No attempt is made to
|
| 1019 |
+
extract a mask from categories 2 and 4 if `numpy.isfinite`
|
| 1020 |
+
does not yield a Boolean array. Category 3 is included to
|
| 1021 |
+
support RGB or RGBA ndarrays, which are assumed to have only
|
| 1022 |
+
valid values and which are passed through unchanged.
|
| 1023 |
+
|
| 1024 |
+
All input arguments that are not passed unchanged are returned
|
| 1025 |
+
as masked arrays if any masked points are found, otherwise as
|
| 1026 |
+
ndarrays.
|
| 1027 |
+
|
| 1028 |
+
"""
|
| 1029 |
+
if not len(args):
|
| 1030 |
+
return ()
|
| 1031 |
+
if is_scalar_or_string(args[0]):
|
| 1032 |
+
raise ValueError("First argument must be a sequence")
|
| 1033 |
+
nrecs = len(args[0])
|
| 1034 |
+
margs = [] # Output args; some may be modified.
|
| 1035 |
+
seqlist = [False] * len(args) # Flags: True if output will be masked.
|
| 1036 |
+
masks = [] # List of masks.
|
| 1037 |
+
for i, x in enumerate(args):
|
| 1038 |
+
if is_scalar_or_string(x) or len(x) != nrecs:
|
| 1039 |
+
margs.append(x) # Leave it unmodified.
|
| 1040 |
+
else:
|
| 1041 |
+
if isinstance(x, np.ma.MaskedArray) and x.ndim > 1:
|
| 1042 |
+
raise ValueError("Masked arrays must be 1-D")
|
| 1043 |
+
try:
|
| 1044 |
+
x = np.asanyarray(x)
|
| 1045 |
+
except (VisibleDeprecationWarning, ValueError):
|
| 1046 |
+
# NumPy 1.19 raises a warning about ragged arrays, but we want
|
| 1047 |
+
# to accept basically anything here.
|
| 1048 |
+
x = np.asanyarray(x, dtype=object)
|
| 1049 |
+
if x.ndim == 1:
|
| 1050 |
+
x = safe_masked_invalid(x)
|
| 1051 |
+
seqlist[i] = True
|
| 1052 |
+
if np.ma.is_masked(x):
|
| 1053 |
+
masks.append(np.ma.getmaskarray(x))
|
| 1054 |
+
margs.append(x) # Possibly modified.
|
| 1055 |
+
if len(masks):
|
| 1056 |
+
mask = np.logical_or.reduce(masks)
|
| 1057 |
+
for i, x in enumerate(margs):
|
| 1058 |
+
if seqlist[i]:
|
| 1059 |
+
margs[i] = np.ma.array(x, mask=mask)
|
| 1060 |
+
return margs
|
| 1061 |
+
|
| 1062 |
+
|
| 1063 |
+
def _broadcast_with_masks(*args, compress=False):
|
| 1064 |
+
"""
|
| 1065 |
+
Broadcast inputs, combining all masked arrays.
|
| 1066 |
+
|
| 1067 |
+
Parameters
|
| 1068 |
+
----------
|
| 1069 |
+
*args : array-like
|
| 1070 |
+
The inputs to broadcast.
|
| 1071 |
+
compress : bool, default: False
|
| 1072 |
+
Whether to compress the masked arrays. If False, the masked values
|
| 1073 |
+
are replaced by NaNs.
|
| 1074 |
+
|
| 1075 |
+
Returns
|
| 1076 |
+
-------
|
| 1077 |
+
list of array-like
|
| 1078 |
+
The broadcasted and masked inputs.
|
| 1079 |
+
"""
|
| 1080 |
+
# extract the masks, if any
|
| 1081 |
+
masks = [k.mask for k in args if isinstance(k, np.ma.MaskedArray)]
|
| 1082 |
+
# broadcast to match the shape
|
| 1083 |
+
bcast = np.broadcast_arrays(*args, *masks)
|
| 1084 |
+
inputs = bcast[:len(args)]
|
| 1085 |
+
masks = bcast[len(args):]
|
| 1086 |
+
if masks:
|
| 1087 |
+
# combine the masks into one
|
| 1088 |
+
mask = np.logical_or.reduce(masks)
|
| 1089 |
+
# put mask on and compress
|
| 1090 |
+
if compress:
|
| 1091 |
+
inputs = [np.ma.array(k, mask=mask).compressed()
|
| 1092 |
+
for k in inputs]
|
| 1093 |
+
else:
|
| 1094 |
+
inputs = [np.ma.array(k, mask=mask, dtype=float).filled(np.nan).ravel()
|
| 1095 |
+
for k in inputs]
|
| 1096 |
+
else:
|
| 1097 |
+
inputs = [np.ravel(k) for k in inputs]
|
| 1098 |
+
return inputs
|
| 1099 |
+
|
| 1100 |
+
|
| 1101 |
+
def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None, autorange=False):
|
| 1102 |
+
r"""
|
| 1103 |
+
Return a list of dictionaries of statistics used to draw a series of box
|
| 1104 |
+
and whisker plots using `~.Axes.bxp`.
|
| 1105 |
+
|
| 1106 |
+
Parameters
|
| 1107 |
+
----------
|
| 1108 |
+
X : array-like
|
| 1109 |
+
Data that will be represented in the boxplots. Should have 2 or
|
| 1110 |
+
fewer dimensions.
|
| 1111 |
+
|
| 1112 |
+
whis : float or (float, float), default: 1.5
|
| 1113 |
+
The position of the whiskers.
|
| 1114 |
+
|
| 1115 |
+
If a float, the lower whisker is at the lowest datum above
|
| 1116 |
+
``Q1 - whis*(Q3-Q1)``, and the upper whisker at the highest datum below
|
| 1117 |
+
``Q3 + whis*(Q3-Q1)``, where Q1 and Q3 are the first and third
|
| 1118 |
+
quartiles. The default value of ``whis = 1.5`` corresponds to Tukey's
|
| 1119 |
+
original definition of boxplots.
|
| 1120 |
+
|
| 1121 |
+
If a pair of floats, they indicate the percentiles at which to draw the
|
| 1122 |
+
whiskers (e.g., (5, 95)). In particular, setting this to (0, 100)
|
| 1123 |
+
results in whiskers covering the whole range of the data.
|
| 1124 |
+
|
| 1125 |
+
In the edge case where ``Q1 == Q3``, *whis* is automatically set to
|
| 1126 |
+
(0, 100) (cover the whole range of the data) if *autorange* is True.
|
| 1127 |
+
|
| 1128 |
+
Beyond the whiskers, data are considered outliers and are plotted as
|
| 1129 |
+
individual points.
|
| 1130 |
+
|
| 1131 |
+
bootstrap : int, optional
|
| 1132 |
+
Number of times the confidence intervals around the median
|
| 1133 |
+
should be bootstrapped (percentile method).
|
| 1134 |
+
|
| 1135 |
+
labels : list of str, optional
|
| 1136 |
+
Labels for each dataset. Length must be compatible with
|
| 1137 |
+
dimensions of *X*.
|
| 1138 |
+
|
| 1139 |
+
autorange : bool, optional (False)
|
| 1140 |
+
When `True` and the data are distributed such that the 25th and 75th
|
| 1141 |
+
percentiles are equal, ``whis`` is set to (0, 100) such that the
|
| 1142 |
+
whisker ends are at the minimum and maximum of the data.
|
| 1143 |
+
|
| 1144 |
+
Returns
|
| 1145 |
+
-------
|
| 1146 |
+
list of dict
|
| 1147 |
+
A list of dictionaries containing the results for each column
|
| 1148 |
+
of data. Keys of each dictionary are the following:
|
| 1149 |
+
|
| 1150 |
+
======== ===================================
|
| 1151 |
+
Key Value Description
|
| 1152 |
+
======== ===================================
|
| 1153 |
+
label tick label for the boxplot
|
| 1154 |
+
mean arithmetic mean value
|
| 1155 |
+
med 50th percentile
|
| 1156 |
+
q1 first quartile (25th percentile)
|
| 1157 |
+
q3 third quartile (75th percentile)
|
| 1158 |
+
iqr interquartile range
|
| 1159 |
+
cilo lower notch around the median
|
| 1160 |
+
cihi upper notch around the median
|
| 1161 |
+
whislo end of the lower whisker
|
| 1162 |
+
whishi end of the upper whisker
|
| 1163 |
+
fliers outliers
|
| 1164 |
+
======== ===================================
|
| 1165 |
+
|
| 1166 |
+
Notes
|
| 1167 |
+
-----
|
| 1168 |
+
Non-bootstrapping approach to confidence interval uses Gaussian-based
|
| 1169 |
+
asymptotic approximation:
|
| 1170 |
+
|
| 1171 |
+
.. math::
|
| 1172 |
+
|
| 1173 |
+
\mathrm{med} \pm 1.57 \times \frac{\mathrm{iqr}}{\sqrt{N}}
|
| 1174 |
+
|
| 1175 |
+
General approach from:
|
| 1176 |
+
McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of
|
| 1177 |
+
Boxplots", The American Statistician, 32:12-16.
|
| 1178 |
+
"""
|
| 1179 |
+
|
| 1180 |
+
def _bootstrap_median(data, N=5000):
|
| 1181 |
+
# determine 95% confidence intervals of the median
|
| 1182 |
+
M = len(data)
|
| 1183 |
+
percentiles = [2.5, 97.5]
|
| 1184 |
+
|
| 1185 |
+
bs_index = np.random.randint(M, size=(N, M))
|
| 1186 |
+
bsData = data[bs_index]
|
| 1187 |
+
estimate = np.median(bsData, axis=1, overwrite_input=True)
|
| 1188 |
+
|
| 1189 |
+
CI = np.percentile(estimate, percentiles)
|
| 1190 |
+
return CI
|
| 1191 |
+
|
| 1192 |
+
def _compute_conf_interval(data, med, iqr, bootstrap):
|
| 1193 |
+
if bootstrap is not None:
|
| 1194 |
+
# Do a bootstrap estimate of notch locations.
|
| 1195 |
+
# get conf. intervals around median
|
| 1196 |
+
CI = _bootstrap_median(data, N=bootstrap)
|
| 1197 |
+
notch_min = CI[0]
|
| 1198 |
+
notch_max = CI[1]
|
| 1199 |
+
else:
|
| 1200 |
+
|
| 1201 |
+
N = len(data)
|
| 1202 |
+
notch_min = med - 1.57 * iqr / np.sqrt(N)
|
| 1203 |
+
notch_max = med + 1.57 * iqr / np.sqrt(N)
|
| 1204 |
+
|
| 1205 |
+
return notch_min, notch_max
|
| 1206 |
+
|
| 1207 |
+
# output is a list of dicts
|
| 1208 |
+
bxpstats = []
|
| 1209 |
+
|
| 1210 |
+
# convert X to a list of lists
|
| 1211 |
+
X = _reshape_2D(X, "X")
|
| 1212 |
+
|
| 1213 |
+
ncols = len(X)
|
| 1214 |
+
if labels is None:
|
| 1215 |
+
labels = itertools.repeat(None)
|
| 1216 |
+
elif len(labels) != ncols:
|
| 1217 |
+
raise ValueError("Dimensions of labels and X must be compatible")
|
| 1218 |
+
|
| 1219 |
+
input_whis = whis
|
| 1220 |
+
for ii, (x, label) in enumerate(zip(X, labels)):
|
| 1221 |
+
|
| 1222 |
+
# empty dict
|
| 1223 |
+
stats = {}
|
| 1224 |
+
if label is not None:
|
| 1225 |
+
stats['label'] = label
|
| 1226 |
+
|
| 1227 |
+
# restore whis to the input values in case it got changed in the loop
|
| 1228 |
+
whis = input_whis
|
| 1229 |
+
|
| 1230 |
+
# note tricksiness, append up here and then mutate below
|
| 1231 |
+
bxpstats.append(stats)
|
| 1232 |
+
|
| 1233 |
+
# if empty, bail
|
| 1234 |
+
if len(x) == 0:
|
| 1235 |
+
stats['fliers'] = np.array([])
|
| 1236 |
+
stats['mean'] = np.nan
|
| 1237 |
+
stats['med'] = np.nan
|
| 1238 |
+
stats['q1'] = np.nan
|
| 1239 |
+
stats['q3'] = np.nan
|
| 1240 |
+
stats['iqr'] = np.nan
|
| 1241 |
+
stats['cilo'] = np.nan
|
| 1242 |
+
stats['cihi'] = np.nan
|
| 1243 |
+
stats['whislo'] = np.nan
|
| 1244 |
+
stats['whishi'] = np.nan
|
| 1245 |
+
continue
|
| 1246 |
+
|
| 1247 |
+
# up-convert to an array, just to be safe
|
| 1248 |
+
x = np.ma.asarray(x)
|
| 1249 |
+
x = x.data[~x.mask].ravel()
|
| 1250 |
+
|
| 1251 |
+
# arithmetic mean
|
| 1252 |
+
stats['mean'] = np.mean(x)
|
| 1253 |
+
|
| 1254 |
+
# medians and quartiles
|
| 1255 |
+
q1, med, q3 = np.percentile(x, [25, 50, 75])
|
| 1256 |
+
|
| 1257 |
+
# interquartile range
|
| 1258 |
+
stats['iqr'] = q3 - q1
|
| 1259 |
+
if stats['iqr'] == 0 and autorange:
|
| 1260 |
+
whis = (0, 100)
|
| 1261 |
+
|
| 1262 |
+
# conf. interval around median
|
| 1263 |
+
stats['cilo'], stats['cihi'] = _compute_conf_interval(
|
| 1264 |
+
x, med, stats['iqr'], bootstrap
|
| 1265 |
+
)
|
| 1266 |
+
|
| 1267 |
+
# lowest/highest non-outliers
|
| 1268 |
+
if np.iterable(whis) and not isinstance(whis, str):
|
| 1269 |
+
loval, hival = np.percentile(x, whis)
|
| 1270 |
+
elif np.isreal(whis):
|
| 1271 |
+
loval = q1 - whis * stats['iqr']
|
| 1272 |
+
hival = q3 + whis * stats['iqr']
|
| 1273 |
+
else:
|
| 1274 |
+
raise ValueError('whis must be a float or list of percentiles')
|
| 1275 |
+
|
| 1276 |
+
# get high extreme
|
| 1277 |
+
wiskhi = x[x <= hival]
|
| 1278 |
+
if len(wiskhi) == 0 or np.max(wiskhi) < q3:
|
| 1279 |
+
stats['whishi'] = q3
|
| 1280 |
+
else:
|
| 1281 |
+
stats['whishi'] = np.max(wiskhi)
|
| 1282 |
+
|
| 1283 |
+
# get low extreme
|
| 1284 |
+
wisklo = x[x >= loval]
|
| 1285 |
+
if len(wisklo) == 0 or np.min(wisklo) > q1:
|
| 1286 |
+
stats['whislo'] = q1
|
| 1287 |
+
else:
|
| 1288 |
+
stats['whislo'] = np.min(wisklo)
|
| 1289 |
+
|
| 1290 |
+
# compute a single array of outliers
|
| 1291 |
+
stats['fliers'] = np.concatenate([
|
| 1292 |
+
x[x < stats['whislo']],
|
| 1293 |
+
x[x > stats['whishi']],
|
| 1294 |
+
])
|
| 1295 |
+
|
| 1296 |
+
# add in the remaining stats
|
| 1297 |
+
stats['q1'], stats['med'], stats['q3'] = q1, med, q3
|
| 1298 |
+
|
| 1299 |
+
return bxpstats
|
| 1300 |
+
|
| 1301 |
+
|
| 1302 |
+
#: Maps short codes for line style to their full name used by backends.
|
| 1303 |
+
ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted'}
|
| 1304 |
+
#: Maps full names for line styles used by backends to their short codes.
|
| 1305 |
+
ls_mapper_r = {v: k for k, v in ls_mapper.items()}
|
| 1306 |
+
|
| 1307 |
+
|
| 1308 |
+
def contiguous_regions(mask):
|
| 1309 |
+
"""
|
| 1310 |
+
Return a list of (ind0, ind1) such that ``mask[ind0:ind1].all()`` is
|
| 1311 |
+
True and we cover all such regions.
|
| 1312 |
+
"""
|
| 1313 |
+
mask = np.asarray(mask, dtype=bool)
|
| 1314 |
+
|
| 1315 |
+
if not mask.size:
|
| 1316 |
+
return []
|
| 1317 |
+
|
| 1318 |
+
# Find the indices of region changes, and correct offset
|
| 1319 |
+
idx, = np.nonzero(mask[:-1] != mask[1:])
|
| 1320 |
+
idx += 1
|
| 1321 |
+
|
| 1322 |
+
# List operations are faster for moderately sized arrays
|
| 1323 |
+
idx = idx.tolist()
|
| 1324 |
+
|
| 1325 |
+
# Add first and/or last index if needed
|
| 1326 |
+
if mask[0]:
|
| 1327 |
+
idx = [0] + idx
|
| 1328 |
+
if mask[-1]:
|
| 1329 |
+
idx.append(len(mask))
|
| 1330 |
+
|
| 1331 |
+
return list(zip(idx[::2], idx[1::2]))
|
| 1332 |
+
|
| 1333 |
+
|
| 1334 |
+
def is_math_text(s):
|
| 1335 |
+
"""
|
| 1336 |
+
Return whether the string *s* contains math expressions.
|
| 1337 |
+
|
| 1338 |
+
This is done by checking whether *s* contains an even number of
|
| 1339 |
+
non-escaped dollar signs.
|
| 1340 |
+
"""
|
| 1341 |
+
s = str(s)
|
| 1342 |
+
dollar_count = s.count(r'$') - s.count(r'\$')
|
| 1343 |
+
even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)
|
| 1344 |
+
return even_dollars
|
| 1345 |
+
|
| 1346 |
+
|
| 1347 |
+
def _to_unmasked_float_array(x):
|
| 1348 |
+
"""
|
| 1349 |
+
Convert a sequence to a float array; if input was a masked array, masked
|
| 1350 |
+
values are converted to nans.
|
| 1351 |
+
"""
|
| 1352 |
+
if hasattr(x, 'mask'):
|
| 1353 |
+
return np.ma.asarray(x, float).filled(np.nan)
|
| 1354 |
+
else:
|
| 1355 |
+
return np.asarray(x, float)
|
| 1356 |
+
|
| 1357 |
+
|
| 1358 |
+
def _check_1d(x):
|
| 1359 |
+
"""Convert scalars to 1D arrays; pass-through arrays as is."""
|
| 1360 |
+
# Unpack in case of e.g. Pandas or xarray object
|
| 1361 |
+
x = _unpack_to_numpy(x)
|
| 1362 |
+
# plot requires `shape` and `ndim`. If passed an
|
| 1363 |
+
# object that doesn't provide them, then force to numpy array.
|
| 1364 |
+
# Note this will strip unit information.
|
| 1365 |
+
if (not hasattr(x, 'shape') or
|
| 1366 |
+
not hasattr(x, 'ndim') or
|
| 1367 |
+
len(x.shape) < 1):
|
| 1368 |
+
return np.atleast_1d(x)
|
| 1369 |
+
else:
|
| 1370 |
+
return x
|
| 1371 |
+
|
| 1372 |
+
|
| 1373 |
+
def _reshape_2D(X, name):
|
| 1374 |
+
"""
|
| 1375 |
+
Use Fortran ordering to convert ndarrays and lists of iterables to lists of
|
| 1376 |
+
1D arrays.
|
| 1377 |
+
|
| 1378 |
+
Lists of iterables are converted by applying `numpy.asanyarray` to each of
|
| 1379 |
+
their elements. 1D ndarrays are returned in a singleton list containing
|
| 1380 |
+
them. 2D ndarrays are converted to the list of their *columns*.
|
| 1381 |
+
|
| 1382 |
+
*name* is used to generate the error message for invalid inputs.
|
| 1383 |
+
"""
|
| 1384 |
+
|
| 1385 |
+
# Unpack in case of e.g. Pandas or xarray object
|
| 1386 |
+
X = _unpack_to_numpy(X)
|
| 1387 |
+
|
| 1388 |
+
# Iterate over columns for ndarrays.
|
| 1389 |
+
if isinstance(X, np.ndarray):
|
| 1390 |
+
X = X.transpose()
|
| 1391 |
+
|
| 1392 |
+
if len(X) == 0:
|
| 1393 |
+
return [[]]
|
| 1394 |
+
elif X.ndim == 1 and np.ndim(X[0]) == 0:
|
| 1395 |
+
# 1D array of scalars: directly return it.
|
| 1396 |
+
return [X]
|
| 1397 |
+
elif X.ndim in [1, 2]:
|
| 1398 |
+
# 2D array, or 1D array of iterables: flatten them first.
|
| 1399 |
+
return [np.reshape(x, -1) for x in X]
|
| 1400 |
+
else:
|
| 1401 |
+
raise ValueError(f'{name} must have 2 or fewer dimensions')
|
| 1402 |
+
|
| 1403 |
+
# Iterate over list of iterables.
|
| 1404 |
+
if len(X) == 0:
|
| 1405 |
+
return [[]]
|
| 1406 |
+
|
| 1407 |
+
result = []
|
| 1408 |
+
is_1d = True
|
| 1409 |
+
for xi in X:
|
| 1410 |
+
# check if this is iterable, except for strings which we
|
| 1411 |
+
# treat as singletons.
|
| 1412 |
+
if not isinstance(xi, str):
|
| 1413 |
+
try:
|
| 1414 |
+
iter(xi)
|
| 1415 |
+
except TypeError:
|
| 1416 |
+
pass
|
| 1417 |
+
else:
|
| 1418 |
+
is_1d = False
|
| 1419 |
+
xi = np.asanyarray(xi)
|
| 1420 |
+
nd = np.ndim(xi)
|
| 1421 |
+
if nd > 1:
|
| 1422 |
+
raise ValueError(f'{name} must have 2 or fewer dimensions')
|
| 1423 |
+
result.append(xi.reshape(-1))
|
| 1424 |
+
|
| 1425 |
+
if is_1d:
|
| 1426 |
+
# 1D array of scalars: directly return it.
|
| 1427 |
+
return [np.reshape(result, -1)]
|
| 1428 |
+
else:
|
| 1429 |
+
# 2D array, or 1D array of iterables: use flattened version.
|
| 1430 |
+
return result
|
| 1431 |
+
|
| 1432 |
+
|
| 1433 |
+
def violin_stats(X, method, points=100, quantiles=None):
|
| 1434 |
+
"""
|
| 1435 |
+
Return a list of dictionaries of data which can be used to draw a series
|
| 1436 |
+
of violin plots.
|
| 1437 |
+
|
| 1438 |
+
See the ``Returns`` section below to view the required keys of the
|
| 1439 |
+
dictionary.
|
| 1440 |
+
|
| 1441 |
+
Users can skip this function and pass a user-defined set of dictionaries
|
| 1442 |
+
with the same keys to `~.axes.Axes.violinplot` instead of using Matplotlib
|
| 1443 |
+
to do the calculations. See the *Returns* section below for the keys
|
| 1444 |
+
that must be present in the dictionaries.
|
| 1445 |
+
|
| 1446 |
+
Parameters
|
| 1447 |
+
----------
|
| 1448 |
+
X : array-like
|
| 1449 |
+
Sample data that will be used to produce the gaussian kernel density
|
| 1450 |
+
estimates. Must have 2 or fewer dimensions.
|
| 1451 |
+
|
| 1452 |
+
method : callable
|
| 1453 |
+
The method used to calculate the kernel density estimate for each
|
| 1454 |
+
column of data. When called via ``method(v, coords)``, it should
|
| 1455 |
+
return a vector of the values of the KDE evaluated at the values
|
| 1456 |
+
specified in coords.
|
| 1457 |
+
|
| 1458 |
+
points : int, default: 100
|
| 1459 |
+
Defines the number of points to evaluate each of the gaussian kernel
|
| 1460 |
+
density estimates at.
|
| 1461 |
+
|
| 1462 |
+
quantiles : array-like, default: None
|
| 1463 |
+
Defines (if not None) a list of floats in interval [0, 1] for each
|
| 1464 |
+
column of data, which represents the quantiles that will be rendered
|
| 1465 |
+
for that column of data. Must have 2 or fewer dimensions. 1D array will
|
| 1466 |
+
be treated as a singleton list containing them.
|
| 1467 |
+
|
| 1468 |
+
Returns
|
| 1469 |
+
-------
|
| 1470 |
+
list of dict
|
| 1471 |
+
A list of dictionaries containing the results for each column of data.
|
| 1472 |
+
The dictionaries contain at least the following:
|
| 1473 |
+
|
| 1474 |
+
- coords: A list of scalars containing the coordinates this particular
|
| 1475 |
+
kernel density estimate was evaluated at.
|
| 1476 |
+
- vals: A list of scalars containing the values of the kernel density
|
| 1477 |
+
estimate at each of the coordinates given in *coords*.
|
| 1478 |
+
- mean: The mean value for this column of data.
|
| 1479 |
+
- median: The median value for this column of data.
|
| 1480 |
+
- min: The minimum value for this column of data.
|
| 1481 |
+
- max: The maximum value for this column of data.
|
| 1482 |
+
- quantiles: The quantile values for this column of data.
|
| 1483 |
+
"""
|
| 1484 |
+
|
| 1485 |
+
# List of dictionaries describing each of the violins.
|
| 1486 |
+
vpstats = []
|
| 1487 |
+
|
| 1488 |
+
# Want X to be a list of data sequences
|
| 1489 |
+
X = _reshape_2D(X, "X")
|
| 1490 |
+
|
| 1491 |
+
# Want quantiles to be as the same shape as data sequences
|
| 1492 |
+
if quantiles is not None and len(quantiles) != 0:
|
| 1493 |
+
quantiles = _reshape_2D(quantiles, "quantiles")
|
| 1494 |
+
# Else, mock quantiles if it's none or empty
|
| 1495 |
+
else:
|
| 1496 |
+
quantiles = [[]] * len(X)
|
| 1497 |
+
|
| 1498 |
+
# quantiles should have the same size as dataset
|
| 1499 |
+
if len(X) != len(quantiles):
|
| 1500 |
+
raise ValueError("List of violinplot statistics and quantiles values"
|
| 1501 |
+
" must have the same length")
|
| 1502 |
+
|
| 1503 |
+
# Zip x and quantiles
|
| 1504 |
+
for (x, q) in zip(X, quantiles):
|
| 1505 |
+
# Dictionary of results for this distribution
|
| 1506 |
+
stats = {}
|
| 1507 |
+
|
| 1508 |
+
# Calculate basic stats for the distribution
|
| 1509 |
+
min_val = np.min(x)
|
| 1510 |
+
max_val = np.max(x)
|
| 1511 |
+
quantile_val = np.percentile(x, 100 * q)
|
| 1512 |
+
|
| 1513 |
+
# Evaluate the kernel density estimate
|
| 1514 |
+
coords = np.linspace(min_val, max_val, points)
|
| 1515 |
+
stats['vals'] = method(x, coords)
|
| 1516 |
+
stats['coords'] = coords
|
| 1517 |
+
|
| 1518 |
+
# Store additional statistics for this distribution
|
| 1519 |
+
stats['mean'] = np.mean(x)
|
| 1520 |
+
stats['median'] = np.median(x)
|
| 1521 |
+
stats['min'] = min_val
|
| 1522 |
+
stats['max'] = max_val
|
| 1523 |
+
stats['quantiles'] = np.atleast_1d(quantile_val)
|
| 1524 |
+
|
| 1525 |
+
# Append to output
|
| 1526 |
+
vpstats.append(stats)
|
| 1527 |
+
|
| 1528 |
+
return vpstats
|
| 1529 |
+
|
| 1530 |
+
|
| 1531 |
+
def pts_to_prestep(x, *args):
|
| 1532 |
+
"""
|
| 1533 |
+
Convert continuous line to pre-steps.
|
| 1534 |
+
|
| 1535 |
+
Given a set of ``N`` points, convert to ``2N - 1`` points, which when
|
| 1536 |
+
connected linearly give a step function which changes values at the
|
| 1537 |
+
beginning of the intervals.
|
| 1538 |
+
|
| 1539 |
+
Parameters
|
| 1540 |
+
----------
|
| 1541 |
+
x : array
|
| 1542 |
+
The x location of the steps. May be empty.
|
| 1543 |
+
|
| 1544 |
+
y1, ..., yp : array
|
| 1545 |
+
y arrays to be turned into steps; all must be the same length as ``x``.
|
| 1546 |
+
|
| 1547 |
+
Returns
|
| 1548 |
+
-------
|
| 1549 |
+
array
|
| 1550 |
+
The x and y values converted to steps in the same order as the input;
|
| 1551 |
+
can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
|
| 1552 |
+
length ``N``, each of these arrays will be length ``2N + 1``. For
|
| 1553 |
+
``N=0``, the length will be 0.
|
| 1554 |
+
|
| 1555 |
+
Examples
|
| 1556 |
+
--------
|
| 1557 |
+
>>> x_s, y1_s, y2_s = pts_to_prestep(x, y1, y2)
|
| 1558 |
+
"""
|
| 1559 |
+
steps = np.zeros((1 + len(args), max(2 * len(x) - 1, 0)))
|
| 1560 |
+
# In all `pts_to_*step` functions, only assign once using *x* and *args*,
|
| 1561 |
+
# as converting to an array may be expensive.
|
| 1562 |
+
steps[0, 0::2] = x
|
| 1563 |
+
steps[0, 1::2] = steps[0, 0:-2:2]
|
| 1564 |
+
steps[1:, 0::2] = args
|
| 1565 |
+
steps[1:, 1::2] = steps[1:, 2::2]
|
| 1566 |
+
return steps
|
| 1567 |
+
|
| 1568 |
+
|
| 1569 |
+
def pts_to_poststep(x, *args):
|
| 1570 |
+
"""
|
| 1571 |
+
Convert continuous line to post-steps.
|
| 1572 |
+
|
| 1573 |
+
Given a set of ``N`` points convert to ``2N + 1`` points, which when
|
| 1574 |
+
connected linearly give a step function which changes values at the end of
|
| 1575 |
+
the intervals.
|
| 1576 |
+
|
| 1577 |
+
Parameters
|
| 1578 |
+
----------
|
| 1579 |
+
x : array
|
| 1580 |
+
The x location of the steps. May be empty.
|
| 1581 |
+
|
| 1582 |
+
y1, ..., yp : array
|
| 1583 |
+
y arrays to be turned into steps; all must be the same length as ``x``.
|
| 1584 |
+
|
| 1585 |
+
Returns
|
| 1586 |
+
-------
|
| 1587 |
+
array
|
| 1588 |
+
The x and y values converted to steps in the same order as the input;
|
| 1589 |
+
can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
|
| 1590 |
+
length ``N``, each of these arrays will be length ``2N + 1``. For
|
| 1591 |
+
``N=0``, the length will be 0.
|
| 1592 |
+
|
| 1593 |
+
Examples
|
| 1594 |
+
--------
|
| 1595 |
+
>>> x_s, y1_s, y2_s = pts_to_poststep(x, y1, y2)
|
| 1596 |
+
"""
|
| 1597 |
+
steps = np.zeros((1 + len(args), max(2 * len(x) - 1, 0)))
|
| 1598 |
+
steps[0, 0::2] = x
|
| 1599 |
+
steps[0, 1::2] = steps[0, 2::2]
|
| 1600 |
+
steps[1:, 0::2] = args
|
| 1601 |
+
steps[1:, 1::2] = steps[1:, 0:-2:2]
|
| 1602 |
+
return steps
|
| 1603 |
+
|
| 1604 |
+
|
| 1605 |
+
def pts_to_midstep(x, *args):
|
| 1606 |
+
"""
|
| 1607 |
+
Convert continuous line to mid-steps.
|
| 1608 |
+
|
| 1609 |
+
Given a set of ``N`` points convert to ``2N`` points which when connected
|
| 1610 |
+
linearly give a step function which changes values at the middle of the
|
| 1611 |
+
intervals.
|
| 1612 |
+
|
| 1613 |
+
Parameters
|
| 1614 |
+
----------
|
| 1615 |
+
x : array
|
| 1616 |
+
The x location of the steps. May be empty.
|
| 1617 |
+
|
| 1618 |
+
y1, ..., yp : array
|
| 1619 |
+
y arrays to be turned into steps; all must be the same length as
|
| 1620 |
+
``x``.
|
| 1621 |
+
|
| 1622 |
+
Returns
|
| 1623 |
+
-------
|
| 1624 |
+
array
|
| 1625 |
+
The x and y values converted to steps in the same order as the input;
|
| 1626 |
+
can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
|
| 1627 |
+
length ``N``, each of these arrays will be length ``2N``.
|
| 1628 |
+
|
| 1629 |
+
Examples
|
| 1630 |
+
--------
|
| 1631 |
+
>>> x_s, y1_s, y2_s = pts_to_midstep(x, y1, y2)
|
| 1632 |
+
"""
|
| 1633 |
+
steps = np.zeros((1 + len(args), 2 * len(x)))
|
| 1634 |
+
x = np.asanyarray(x)
|
| 1635 |
+
steps[0, 1:-1:2] = steps[0, 2::2] = (x[:-1] + x[1:]) / 2
|
| 1636 |
+
steps[0, :1] = x[:1] # Also works for zero-sized input.
|
| 1637 |
+
steps[0, -1:] = x[-1:]
|
| 1638 |
+
steps[1:, 0::2] = args
|
| 1639 |
+
steps[1:, 1::2] = steps[1:, 0::2]
|
| 1640 |
+
return steps
|
| 1641 |
+
|
| 1642 |
+
|
| 1643 |
+
STEP_LOOKUP_MAP = {'default': lambda x, y: (x, y),
|
| 1644 |
+
'steps': pts_to_prestep,
|
| 1645 |
+
'steps-pre': pts_to_prestep,
|
| 1646 |
+
'steps-post': pts_to_poststep,
|
| 1647 |
+
'steps-mid': pts_to_midstep}
|
| 1648 |
+
|
| 1649 |
+
|
| 1650 |
+
def index_of(y):
|
| 1651 |
+
"""
|
| 1652 |
+
A helper function to create reasonable x values for the given *y*.
|
| 1653 |
+
|
| 1654 |
+
This is used for plotting (x, y) if x values are not explicitly given.
|
| 1655 |
+
|
| 1656 |
+
First try ``y.index`` (assuming *y* is a `pandas.Series`), if that
|
| 1657 |
+
fails, use ``range(len(y))``.
|
| 1658 |
+
|
| 1659 |
+
This will be extended in the future to deal with more types of
|
| 1660 |
+
labeled data.
|
| 1661 |
+
|
| 1662 |
+
Parameters
|
| 1663 |
+
----------
|
| 1664 |
+
y : float or array-like
|
| 1665 |
+
|
| 1666 |
+
Returns
|
| 1667 |
+
-------
|
| 1668 |
+
x, y : ndarray
|
| 1669 |
+
The x and y values to plot.
|
| 1670 |
+
"""
|
| 1671 |
+
try:
|
| 1672 |
+
return y.index.to_numpy(), y.to_numpy()
|
| 1673 |
+
except AttributeError:
|
| 1674 |
+
pass
|
| 1675 |
+
try:
|
| 1676 |
+
y = _check_1d(y)
|
| 1677 |
+
except (VisibleDeprecationWarning, ValueError):
|
| 1678 |
+
# NumPy 1.19 will warn on ragged input, and we can't actually use it.
|
| 1679 |
+
pass
|
| 1680 |
+
else:
|
| 1681 |
+
return np.arange(y.shape[0], dtype=float), y
|
| 1682 |
+
raise ValueError('Input could not be cast to an at-least-1D NumPy array')
|
| 1683 |
+
|
| 1684 |
+
|
| 1685 |
+
def safe_first_element(obj):
|
| 1686 |
+
"""
|
| 1687 |
+
Return the first element in *obj*.
|
| 1688 |
+
|
| 1689 |
+
This is a type-independent way of obtaining the first element,
|
| 1690 |
+
supporting both index access and the iterator protocol.
|
| 1691 |
+
"""
|
| 1692 |
+
if isinstance(obj, collections.abc.Iterator):
|
| 1693 |
+
# needed to accept `array.flat` as input.
|
| 1694 |
+
# np.flatiter reports as an instance of collections.Iterator but can still be
|
| 1695 |
+
# indexed via []. This has the side effect of re-setting the iterator, but
|
| 1696 |
+
# that is acceptable.
|
| 1697 |
+
try:
|
| 1698 |
+
return obj[0]
|
| 1699 |
+
except TypeError:
|
| 1700 |
+
pass
|
| 1701 |
+
raise RuntimeError("matplotlib does not support generators as input")
|
| 1702 |
+
return next(iter(obj))
|
| 1703 |
+
|
| 1704 |
+
|
| 1705 |
+
def _safe_first_finite(obj):
|
| 1706 |
+
"""
|
| 1707 |
+
Return the first finite element in *obj* if one is available and skip_nonfinite is
|
| 1708 |
+
True. Otherwise, return the first element.
|
| 1709 |
+
|
| 1710 |
+
This is a method for internal use.
|
| 1711 |
+
|
| 1712 |
+
This is a type-independent way of obtaining the first finite element, supporting
|
| 1713 |
+
both index access and the iterator protocol.
|
| 1714 |
+
"""
|
| 1715 |
+
def safe_isfinite(val):
|
| 1716 |
+
if val is None:
|
| 1717 |
+
return False
|
| 1718 |
+
try:
|
| 1719 |
+
return math.isfinite(val)
|
| 1720 |
+
except (TypeError, ValueError):
|
| 1721 |
+
# if the outer object is 2d, then val is a 1d array, and
|
| 1722 |
+
# - math.isfinite(numpy.zeros(3)) raises TypeError
|
| 1723 |
+
# - math.isfinite(torch.zeros(3)) raises ValueError
|
| 1724 |
+
pass
|
| 1725 |
+
try:
|
| 1726 |
+
return np.isfinite(val) if np.isscalar(val) else True
|
| 1727 |
+
except TypeError:
|
| 1728 |
+
# This is something that NumPy cannot make heads or tails of,
|
| 1729 |
+
# assume "finite"
|
| 1730 |
+
return True
|
| 1731 |
+
|
| 1732 |
+
if isinstance(obj, np.flatiter):
|
| 1733 |
+
# TODO do the finite filtering on this
|
| 1734 |
+
return obj[0]
|
| 1735 |
+
elif isinstance(obj, collections.abc.Iterator):
|
| 1736 |
+
raise RuntimeError("matplotlib does not support generators as input")
|
| 1737 |
+
else:
|
| 1738 |
+
for val in obj:
|
| 1739 |
+
if safe_isfinite(val):
|
| 1740 |
+
return val
|
| 1741 |
+
return safe_first_element(obj)
|
| 1742 |
+
|
| 1743 |
+
|
| 1744 |
+
def sanitize_sequence(data):
|
| 1745 |
+
"""
|
| 1746 |
+
Convert dictview objects to list. Other inputs are returned unchanged.
|
| 1747 |
+
"""
|
| 1748 |
+
return (list(data) if isinstance(data, collections.abc.MappingView)
|
| 1749 |
+
else data)
|
| 1750 |
+
|
| 1751 |
+
|
| 1752 |
+
def normalize_kwargs(kw, alias_mapping=None):
|
| 1753 |
+
"""
|
| 1754 |
+
Helper function to normalize kwarg inputs.
|
| 1755 |
+
|
| 1756 |
+
Parameters
|
| 1757 |
+
----------
|
| 1758 |
+
kw : dict or None
|
| 1759 |
+
A dict of keyword arguments. None is explicitly supported and treated
|
| 1760 |
+
as an empty dict, to support functions with an optional parameter of
|
| 1761 |
+
the form ``props=None``.
|
| 1762 |
+
|
| 1763 |
+
alias_mapping : dict or Artist subclass or Artist instance, optional
|
| 1764 |
+
A mapping between a canonical name to a list of aliases, in order of
|
| 1765 |
+
precedence from lowest to highest.
|
| 1766 |
+
|
| 1767 |
+
If the canonical value is not in the list it is assumed to have the
|
| 1768 |
+
highest priority.
|
| 1769 |
+
|
| 1770 |
+
If an Artist subclass or instance is passed, use its properties alias
|
| 1771 |
+
mapping.
|
| 1772 |
+
|
| 1773 |
+
Raises
|
| 1774 |
+
------
|
| 1775 |
+
TypeError
|
| 1776 |
+
To match what Python raises if invalid arguments/keyword arguments are
|
| 1777 |
+
passed to a callable.
|
| 1778 |
+
"""
|
| 1779 |
+
from matplotlib.artist import Artist
|
| 1780 |
+
|
| 1781 |
+
if kw is None:
|
| 1782 |
+
return {}
|
| 1783 |
+
|
| 1784 |
+
# deal with default value of alias_mapping
|
| 1785 |
+
if alias_mapping is None:
|
| 1786 |
+
alias_mapping = {}
|
| 1787 |
+
elif (isinstance(alias_mapping, type) and issubclass(alias_mapping, Artist)
|
| 1788 |
+
or isinstance(alias_mapping, Artist)):
|
| 1789 |
+
alias_mapping = getattr(alias_mapping, "_alias_map", {})
|
| 1790 |
+
|
| 1791 |
+
to_canonical = {alias: canonical
|
| 1792 |
+
for canonical, alias_list in alias_mapping.items()
|
| 1793 |
+
for alias in alias_list}
|
| 1794 |
+
canonical_to_seen = {}
|
| 1795 |
+
ret = {} # output dictionary
|
| 1796 |
+
|
| 1797 |
+
for k, v in kw.items():
|
| 1798 |
+
canonical = to_canonical.get(k, k)
|
| 1799 |
+
if canonical in canonical_to_seen:
|
| 1800 |
+
raise TypeError(f"Got both {canonical_to_seen[canonical]!r} and "
|
| 1801 |
+
f"{k!r}, which are aliases of one another")
|
| 1802 |
+
canonical_to_seen[canonical] = k
|
| 1803 |
+
ret[canonical] = v
|
| 1804 |
+
|
| 1805 |
+
return ret
|
| 1806 |
+
|
| 1807 |
+
|
| 1808 |
+
@contextlib.contextmanager
|
| 1809 |
+
def _lock_path(path):
|
| 1810 |
+
"""
|
| 1811 |
+
Context manager for locking a path.
|
| 1812 |
+
|
| 1813 |
+
Usage::
|
| 1814 |
+
|
| 1815 |
+
with _lock_path(path):
|
| 1816 |
+
...
|
| 1817 |
+
|
| 1818 |
+
Another thread or process that attempts to lock the same path will wait
|
| 1819 |
+
until this context manager is exited.
|
| 1820 |
+
|
| 1821 |
+
The lock is implemented by creating a temporary file in the parent
|
| 1822 |
+
directory, so that directory must exist and be writable.
|
| 1823 |
+
"""
|
| 1824 |
+
path = Path(path)
|
| 1825 |
+
lock_path = path.with_name(path.name + ".matplotlib-lock")
|
| 1826 |
+
retries = 50
|
| 1827 |
+
sleeptime = 0.1
|
| 1828 |
+
for _ in range(retries):
|
| 1829 |
+
try:
|
| 1830 |
+
with lock_path.open("xb"):
|
| 1831 |
+
break
|
| 1832 |
+
except FileExistsError:
|
| 1833 |
+
time.sleep(sleeptime)
|
| 1834 |
+
else:
|
| 1835 |
+
raise TimeoutError("""\
|
| 1836 |
+
Lock error: Matplotlib failed to acquire the following lock file:
|
| 1837 |
+
{}
|
| 1838 |
+
This maybe due to another process holding this lock file. If you are sure no
|
| 1839 |
+
other Matplotlib process is running, remove this file and try again.""".format(
|
| 1840 |
+
lock_path))
|
| 1841 |
+
try:
|
| 1842 |
+
yield
|
| 1843 |
+
finally:
|
| 1844 |
+
lock_path.unlink()
|
| 1845 |
+
|
| 1846 |
+
|
| 1847 |
+
def _topmost_artist(
|
| 1848 |
+
artists,
|
| 1849 |
+
_cached_max=functools.partial(max, key=operator.attrgetter("zorder"))):
|
| 1850 |
+
"""
|
| 1851 |
+
Get the topmost artist of a list.
|
| 1852 |
+
|
| 1853 |
+
In case of a tie, return the *last* of the tied artists, as it will be
|
| 1854 |
+
drawn on top of the others. `max` returns the first maximum in case of
|
| 1855 |
+
ties, so we need to iterate over the list in reverse order.
|
| 1856 |
+
"""
|
| 1857 |
+
return _cached_max(reversed(artists))
|
| 1858 |
+
|
| 1859 |
+
|
| 1860 |
+
def _str_equal(obj, s):
|
| 1861 |
+
"""
|
| 1862 |
+
Return whether *obj* is a string equal to string *s*.
|
| 1863 |
+
|
| 1864 |
+
This helper solely exists to handle the case where *obj* is a numpy array,
|
| 1865 |
+
because in such cases, a naive ``obj == s`` would yield an array, which
|
| 1866 |
+
cannot be used in a boolean context.
|
| 1867 |
+
"""
|
| 1868 |
+
return isinstance(obj, str) and obj == s
|
| 1869 |
+
|
| 1870 |
+
|
| 1871 |
+
def _str_lower_equal(obj, s):
|
| 1872 |
+
"""
|
| 1873 |
+
Return whether *obj* is a string equal, when lowercased, to string *s*.
|
| 1874 |
+
|
| 1875 |
+
This helper solely exists to handle the case where *obj* is a numpy array,
|
| 1876 |
+
because in such cases, a naive ``obj == s`` would yield an array, which
|
| 1877 |
+
cannot be used in a boolean context.
|
| 1878 |
+
"""
|
| 1879 |
+
return isinstance(obj, str) and obj.lower() == s
|
| 1880 |
+
|
| 1881 |
+
|
| 1882 |
+
def _array_perimeter(arr):
|
| 1883 |
+
"""
|
| 1884 |
+
Get the elements on the perimeter of *arr*.
|
| 1885 |
+
|
| 1886 |
+
Parameters
|
| 1887 |
+
----------
|
| 1888 |
+
arr : ndarray, shape (M, N)
|
| 1889 |
+
The input array.
|
| 1890 |
+
|
| 1891 |
+
Returns
|
| 1892 |
+
-------
|
| 1893 |
+
ndarray, shape (2*(M - 1) + 2*(N - 1),)
|
| 1894 |
+
The elements on the perimeter of the array::
|
| 1895 |
+
|
| 1896 |
+
[arr[0, 0], ..., arr[0, -1], ..., arr[-1, -1], ..., arr[-1, 0], ...]
|
| 1897 |
+
|
| 1898 |
+
Examples
|
| 1899 |
+
--------
|
| 1900 |
+
>>> i, j = np.ogrid[:3, :4]
|
| 1901 |
+
>>> a = i*10 + j
|
| 1902 |
+
>>> a
|
| 1903 |
+
array([[ 0, 1, 2, 3],
|
| 1904 |
+
[10, 11, 12, 13],
|
| 1905 |
+
[20, 21, 22, 23]])
|
| 1906 |
+
>>> _array_perimeter(a)
|
| 1907 |
+
array([ 0, 1, 2, 3, 13, 23, 22, 21, 20, 10])
|
| 1908 |
+
"""
|
| 1909 |
+
# note we use Python's half-open ranges to avoid repeating
|
| 1910 |
+
# the corners
|
| 1911 |
+
forward = np.s_[0:-1] # [0 ... -1)
|
| 1912 |
+
backward = np.s_[-1:0:-1] # [-1 ... 0)
|
| 1913 |
+
return np.concatenate((
|
| 1914 |
+
arr[0, forward],
|
| 1915 |
+
arr[forward, -1],
|
| 1916 |
+
arr[-1, backward],
|
| 1917 |
+
arr[backward, 0],
|
| 1918 |
+
))
|
| 1919 |
+
|
| 1920 |
+
|
| 1921 |
+
def _unfold(arr, axis, size, step):
|
| 1922 |
+
"""
|
| 1923 |
+
Append an extra dimension containing sliding windows along *axis*.
|
| 1924 |
+
|
| 1925 |
+
All windows are of size *size* and begin with every *step* elements.
|
| 1926 |
+
|
| 1927 |
+
Parameters
|
| 1928 |
+
----------
|
| 1929 |
+
arr : ndarray, shape (N_1, ..., N_k)
|
| 1930 |
+
The input array
|
| 1931 |
+
axis : int
|
| 1932 |
+
Axis along which the windows are extracted
|
| 1933 |
+
size : int
|
| 1934 |
+
Size of the windows
|
| 1935 |
+
step : int
|
| 1936 |
+
Stride between first elements of subsequent windows.
|
| 1937 |
+
|
| 1938 |
+
Returns
|
| 1939 |
+
-------
|
| 1940 |
+
ndarray, shape (N_1, ..., 1 + (N_axis-size)/step, ..., N_k, size)
|
| 1941 |
+
|
| 1942 |
+
Examples
|
| 1943 |
+
--------
|
| 1944 |
+
>>> i, j = np.ogrid[:3, :7]
|
| 1945 |
+
>>> a = i*10 + j
|
| 1946 |
+
>>> a
|
| 1947 |
+
array([[ 0, 1, 2, 3, 4, 5, 6],
|
| 1948 |
+
[10, 11, 12, 13, 14, 15, 16],
|
| 1949 |
+
[20, 21, 22, 23, 24, 25, 26]])
|
| 1950 |
+
>>> _unfold(a, axis=1, size=3, step=2)
|
| 1951 |
+
array([[[ 0, 1, 2],
|
| 1952 |
+
[ 2, 3, 4],
|
| 1953 |
+
[ 4, 5, 6]],
|
| 1954 |
+
[[10, 11, 12],
|
| 1955 |
+
[12, 13, 14],
|
| 1956 |
+
[14, 15, 16]],
|
| 1957 |
+
[[20, 21, 22],
|
| 1958 |
+
[22, 23, 24],
|
| 1959 |
+
[24, 25, 26]]])
|
| 1960 |
+
"""
|
| 1961 |
+
new_shape = [*arr.shape, size]
|
| 1962 |
+
new_strides = [*arr.strides, arr.strides[axis]]
|
| 1963 |
+
new_shape[axis] = (new_shape[axis] - size) // step + 1
|
| 1964 |
+
new_strides[axis] = new_strides[axis] * step
|
| 1965 |
+
return np.lib.stride_tricks.as_strided(arr,
|
| 1966 |
+
shape=new_shape,
|
| 1967 |
+
strides=new_strides,
|
| 1968 |
+
writeable=False)
|
| 1969 |
+
|
| 1970 |
+
|
| 1971 |
+
def _array_patch_perimeters(x, rstride, cstride):
|
| 1972 |
+
"""
|
| 1973 |
+
Extract perimeters of patches from *arr*.
|
| 1974 |
+
|
| 1975 |
+
Extracted patches are of size (*rstride* + 1) x (*cstride* + 1) and
|
| 1976 |
+
share perimeters with their neighbors. The ordering of the vertices matches
|
| 1977 |
+
that returned by ``_array_perimeter``.
|
| 1978 |
+
|
| 1979 |
+
Parameters
|
| 1980 |
+
----------
|
| 1981 |
+
x : ndarray, shape (N, M)
|
| 1982 |
+
Input array
|
| 1983 |
+
rstride : int
|
| 1984 |
+
Vertical (row) stride between corresponding elements of each patch
|
| 1985 |
+
cstride : int
|
| 1986 |
+
Horizontal (column) stride between corresponding elements of each patch
|
| 1987 |
+
|
| 1988 |
+
Returns
|
| 1989 |
+
-------
|
| 1990 |
+
ndarray, shape (N/rstride * M/cstride, 2 * (rstride + cstride))
|
| 1991 |
+
"""
|
| 1992 |
+
assert rstride > 0 and cstride > 0
|
| 1993 |
+
assert (x.shape[0] - 1) % rstride == 0
|
| 1994 |
+
assert (x.shape[1] - 1) % cstride == 0
|
| 1995 |
+
# We build up each perimeter from four half-open intervals. Here is an
|
| 1996 |
+
# illustrated explanation for rstride == cstride == 3
|
| 1997 |
+
#
|
| 1998 |
+
# T T T R
|
| 1999 |
+
# L R
|
| 2000 |
+
# L R
|
| 2001 |
+
# L B B B
|
| 2002 |
+
#
|
| 2003 |
+
# where T means that this element will be in the top array, R for right,
|
| 2004 |
+
# B for bottom and L for left. Each of the arrays below has a shape of:
|
| 2005 |
+
#
|
| 2006 |
+
# (number of perimeters that can be extracted vertically,
|
| 2007 |
+
# number of perimeters that can be extracted horizontally,
|
| 2008 |
+
# cstride for top and bottom and rstride for left and right)
|
| 2009 |
+
#
|
| 2010 |
+
# Note that _unfold doesn't incur any memory copies, so the only costly
|
| 2011 |
+
# operation here is the np.concatenate.
|
| 2012 |
+
top = _unfold(x[:-1:rstride, :-1], 1, cstride, cstride)
|
| 2013 |
+
bottom = _unfold(x[rstride::rstride, 1:], 1, cstride, cstride)[..., ::-1]
|
| 2014 |
+
right = _unfold(x[:-1, cstride::cstride], 0, rstride, rstride)
|
| 2015 |
+
left = _unfold(x[1:, :-1:cstride], 0, rstride, rstride)[..., ::-1]
|
| 2016 |
+
return (np.concatenate((top, right, bottom, left), axis=2)
|
| 2017 |
+
.reshape(-1, 2 * (rstride + cstride)))
|
| 2018 |
+
|
| 2019 |
+
|
| 2020 |
+
@contextlib.contextmanager
|
| 2021 |
+
def _setattr_cm(obj, **kwargs):
|
| 2022 |
+
"""
|
| 2023 |
+
Temporarily set some attributes; restore original state at context exit.
|
| 2024 |
+
"""
|
| 2025 |
+
sentinel = object()
|
| 2026 |
+
origs = {}
|
| 2027 |
+
for attr in kwargs:
|
| 2028 |
+
orig = getattr(obj, attr, sentinel)
|
| 2029 |
+
if attr in obj.__dict__ or orig is sentinel:
|
| 2030 |
+
# if we are pulling from the instance dict or the object
|
| 2031 |
+
# does not have this attribute we can trust the above
|
| 2032 |
+
origs[attr] = orig
|
| 2033 |
+
else:
|
| 2034 |
+
# if the attribute is not in the instance dict it must be
|
| 2035 |
+
# from the class level
|
| 2036 |
+
cls_orig = getattr(type(obj), attr)
|
| 2037 |
+
# if we are dealing with a property (but not a general descriptor)
|
| 2038 |
+
# we want to set the original value back.
|
| 2039 |
+
if isinstance(cls_orig, property):
|
| 2040 |
+
origs[attr] = orig
|
| 2041 |
+
# otherwise this is _something_ we are going to shadow at
|
| 2042 |
+
# the instance dict level from higher up in the MRO. We
|
| 2043 |
+
# are going to assume we can delattr(obj, attr) to clean
|
| 2044 |
+
# up after ourselves. It is possible that this code will
|
| 2045 |
+
# fail if used with a non-property custom descriptor which
|
| 2046 |
+
# implements __set__ (and __delete__ does not act like a
|
| 2047 |
+
# stack). However, this is an internal tool and we do not
|
| 2048 |
+
# currently have any custom descriptors.
|
| 2049 |
+
else:
|
| 2050 |
+
origs[attr] = sentinel
|
| 2051 |
+
|
| 2052 |
+
try:
|
| 2053 |
+
for attr, val in kwargs.items():
|
| 2054 |
+
setattr(obj, attr, val)
|
| 2055 |
+
yield
|
| 2056 |
+
finally:
|
| 2057 |
+
for attr, orig in origs.items():
|
| 2058 |
+
if orig is sentinel:
|
| 2059 |
+
delattr(obj, attr)
|
| 2060 |
+
else:
|
| 2061 |
+
setattr(obj, attr, orig)
|
| 2062 |
+
|
| 2063 |
+
|
| 2064 |
+
class _OrderedSet(collections.abc.MutableSet):
|
| 2065 |
+
def __init__(self):
|
| 2066 |
+
self._od = collections.OrderedDict()
|
| 2067 |
+
|
| 2068 |
+
def __contains__(self, key):
|
| 2069 |
+
return key in self._od
|
| 2070 |
+
|
| 2071 |
+
def __iter__(self):
|
| 2072 |
+
return iter(self._od)
|
| 2073 |
+
|
| 2074 |
+
def __len__(self):
|
| 2075 |
+
return len(self._od)
|
| 2076 |
+
|
| 2077 |
+
def add(self, key):
|
| 2078 |
+
self._od.pop(key, None)
|
| 2079 |
+
self._od[key] = None
|
| 2080 |
+
|
| 2081 |
+
def discard(self, key):
|
| 2082 |
+
self._od.pop(key, None)
|
| 2083 |
+
|
| 2084 |
+
|
| 2085 |
+
# Agg's buffers are unmultiplied RGBA8888, which neither PyQt<=5.1 nor cairo
|
| 2086 |
+
# support; however, both do support premultiplied ARGB32.
|
| 2087 |
+
|
| 2088 |
+
|
| 2089 |
+
def _premultiplied_argb32_to_unmultiplied_rgba8888(buf):
|
| 2090 |
+
"""
|
| 2091 |
+
Convert a premultiplied ARGB32 buffer to an unmultiplied RGBA8888 buffer.
|
| 2092 |
+
"""
|
| 2093 |
+
rgba = np.take( # .take() ensures C-contiguity of the result.
|
| 2094 |
+
buf,
|
| 2095 |
+
[2, 1, 0, 3] if sys.byteorder == "little" else [1, 2, 3, 0], axis=2)
|
| 2096 |
+
rgb = rgba[..., :-1]
|
| 2097 |
+
alpha = rgba[..., -1]
|
| 2098 |
+
# Un-premultiply alpha. The formula is the same as in cairo-png.c.
|
| 2099 |
+
mask = alpha != 0
|
| 2100 |
+
for channel in np.rollaxis(rgb, -1):
|
| 2101 |
+
channel[mask] = (
|
| 2102 |
+
(channel[mask].astype(int) * 255 + alpha[mask] // 2)
|
| 2103 |
+
// alpha[mask])
|
| 2104 |
+
return rgba
|
| 2105 |
+
|
| 2106 |
+
|
| 2107 |
+
def _unmultiplied_rgba8888_to_premultiplied_argb32(rgba8888):
|
| 2108 |
+
"""
|
| 2109 |
+
Convert an unmultiplied RGBA8888 buffer to a premultiplied ARGB32 buffer.
|
| 2110 |
+
"""
|
| 2111 |
+
if sys.byteorder == "little":
|
| 2112 |
+
argb32 = np.take(rgba8888, [2, 1, 0, 3], axis=2)
|
| 2113 |
+
rgb24 = argb32[..., :-1]
|
| 2114 |
+
alpha8 = argb32[..., -1:]
|
| 2115 |
+
else:
|
| 2116 |
+
argb32 = np.take(rgba8888, [3, 0, 1, 2], axis=2)
|
| 2117 |
+
alpha8 = argb32[..., :1]
|
| 2118 |
+
rgb24 = argb32[..., 1:]
|
| 2119 |
+
# Only bother premultiplying when the alpha channel is not fully opaque,
|
| 2120 |
+
# as the cost is not negligible. The unsafe cast is needed to do the
|
| 2121 |
+
# multiplication in-place in an integer buffer.
|
| 2122 |
+
if alpha8.min() != 0xff:
|
| 2123 |
+
np.multiply(rgb24, alpha8 / 0xff, out=rgb24, casting="unsafe")
|
| 2124 |
+
return argb32
|
| 2125 |
+
|
| 2126 |
+
|
| 2127 |
+
def _get_nonzero_slices(buf):
|
| 2128 |
+
"""
|
| 2129 |
+
Return the bounds of the nonzero region of a 2D array as a pair of slices.
|
| 2130 |
+
|
| 2131 |
+
``buf[_get_nonzero_slices(buf)]`` is the smallest sub-rectangle in *buf*
|
| 2132 |
+
that encloses all non-zero entries in *buf*. If *buf* is fully zero, then
|
| 2133 |
+
``(slice(0, 0), slice(0, 0))`` is returned.
|
| 2134 |
+
"""
|
| 2135 |
+
x_nz, = buf.any(axis=0).nonzero()
|
| 2136 |
+
y_nz, = buf.any(axis=1).nonzero()
|
| 2137 |
+
if len(x_nz) and len(y_nz):
|
| 2138 |
+
l, r = x_nz[[0, -1]]
|
| 2139 |
+
b, t = y_nz[[0, -1]]
|
| 2140 |
+
return slice(b, t + 1), slice(l, r + 1)
|
| 2141 |
+
else:
|
| 2142 |
+
return slice(0, 0), slice(0, 0)
|
| 2143 |
+
|
| 2144 |
+
|
| 2145 |
+
def _pformat_subprocess(command):
|
| 2146 |
+
"""Pretty-format a subprocess command for printing/logging purposes."""
|
| 2147 |
+
return (command if isinstance(command, str)
|
| 2148 |
+
else " ".join(shlex.quote(os.fspath(arg)) for arg in command))
|
| 2149 |
+
|
| 2150 |
+
|
| 2151 |
+
def _check_and_log_subprocess(command, logger, **kwargs):
|
| 2152 |
+
"""
|
| 2153 |
+
Run *command*, returning its stdout output if it succeeds.
|
| 2154 |
+
|
| 2155 |
+
If it fails (exits with nonzero return code), raise an exception whose text
|
| 2156 |
+
includes the failed command and captured stdout and stderr output.
|
| 2157 |
+
|
| 2158 |
+
Regardless of the return code, the command is logged at DEBUG level on
|
| 2159 |
+
*logger*. In case of success, the output is likewise logged.
|
| 2160 |
+
"""
|
| 2161 |
+
logger.debug('%s', _pformat_subprocess(command))
|
| 2162 |
+
proc = subprocess.run(command, capture_output=True, **kwargs)
|
| 2163 |
+
if proc.returncode:
|
| 2164 |
+
stdout = proc.stdout
|
| 2165 |
+
if isinstance(stdout, bytes):
|
| 2166 |
+
stdout = stdout.decode()
|
| 2167 |
+
stderr = proc.stderr
|
| 2168 |
+
if isinstance(stderr, bytes):
|
| 2169 |
+
stderr = stderr.decode()
|
| 2170 |
+
raise RuntimeError(
|
| 2171 |
+
f"The command\n"
|
| 2172 |
+
f" {_pformat_subprocess(command)}\n"
|
| 2173 |
+
f"failed and generated the following output:\n"
|
| 2174 |
+
f"{stdout}\n"
|
| 2175 |
+
f"and the following error:\n"
|
| 2176 |
+
f"{stderr}")
|
| 2177 |
+
if proc.stdout:
|
| 2178 |
+
logger.debug("stdout:\n%s", proc.stdout)
|
| 2179 |
+
if proc.stderr:
|
| 2180 |
+
logger.debug("stderr:\n%s", proc.stderr)
|
| 2181 |
+
return proc.stdout
|
| 2182 |
+
|
| 2183 |
+
|
| 2184 |
+
def _setup_new_guiapp():
|
| 2185 |
+
"""
|
| 2186 |
+
Perform OS-dependent setup when Matplotlib creates a new GUI application.
|
| 2187 |
+
"""
|
| 2188 |
+
# Windows: If not explicit app user model id has been set yet (so we're not
|
| 2189 |
+
# already embedded), then set it to "matplotlib", so that taskbar icons are
|
| 2190 |
+
# correct.
|
| 2191 |
+
try:
|
| 2192 |
+
_c_internal_utils.Win32_GetCurrentProcessExplicitAppUserModelID()
|
| 2193 |
+
except OSError:
|
| 2194 |
+
_c_internal_utils.Win32_SetCurrentProcessExplicitAppUserModelID(
|
| 2195 |
+
"matplotlib")
|
| 2196 |
+
|
| 2197 |
+
|
| 2198 |
+
def _format_approx(number, precision):
|
| 2199 |
+
"""
|
| 2200 |
+
Format the number with at most the number of decimals given as precision.
|
| 2201 |
+
Remove trailing zeros and possibly the decimal point.
|
| 2202 |
+
"""
|
| 2203 |
+
return f'{number:.{precision}f}'.rstrip('0').rstrip('.') or '0'
|
| 2204 |
+
|
| 2205 |
+
|
| 2206 |
+
def _g_sig_digits(value, delta):
|
| 2207 |
+
"""
|
| 2208 |
+
Return the number of significant digits to %g-format *value*, assuming that
|
| 2209 |
+
it is known with an error of *delta*.
|
| 2210 |
+
"""
|
| 2211 |
+
# For inf or nan, the precision doesn't matter.
|
| 2212 |
+
if not math.isfinite(value):
|
| 2213 |
+
return 0
|
| 2214 |
+
if delta == 0:
|
| 2215 |
+
if value == 0:
|
| 2216 |
+
# if both value and delta are 0, np.spacing below returns 5e-324
|
| 2217 |
+
# which results in rather silly results
|
| 2218 |
+
return 3
|
| 2219 |
+
# delta = 0 may occur when trying to format values over a tiny range;
|
| 2220 |
+
# in that case, replace it by the distance to the closest float.
|
| 2221 |
+
delta = abs(np.spacing(value))
|
| 2222 |
+
# If e.g. value = 45.67 and delta = 0.02, then we want to round to 2 digits
|
| 2223 |
+
# after the decimal point (floor(log10(0.02)) = -2); 45.67 contributes 2
|
| 2224 |
+
# digits before the decimal point (floor(log10(45.67)) + 1 = 2): the total
|
| 2225 |
+
# is 4 significant digits. A value of 0 contributes 1 "digit" before the
|
| 2226 |
+
# decimal point.
|
| 2227 |
+
return max(
|
| 2228 |
+
0,
|
| 2229 |
+
(math.floor(math.log10(abs(value))) + 1 if value else 1)
|
| 2230 |
+
- math.floor(math.log10(delta)))
|
| 2231 |
+
|
| 2232 |
+
|
| 2233 |
+
def _unikey_or_keysym_to_mplkey(unikey, keysym):
|
| 2234 |
+
"""
|
| 2235 |
+
Convert a Unicode key or X keysym to a Matplotlib key name.
|
| 2236 |
+
|
| 2237 |
+
The Unicode key is checked first; this avoids having to list most printable
|
| 2238 |
+
keysyms such as ``EuroSign``.
|
| 2239 |
+
"""
|
| 2240 |
+
# For non-printable characters, gtk3 passes "\0" whereas tk passes an "".
|
| 2241 |
+
if unikey and unikey.isprintable():
|
| 2242 |
+
return unikey
|
| 2243 |
+
key = keysym.lower()
|
| 2244 |
+
if key.startswith("kp_"): # keypad_x (including kp_enter).
|
| 2245 |
+
key = key[3:]
|
| 2246 |
+
if key.startswith("page_"): # page_{up,down}
|
| 2247 |
+
key = key.replace("page_", "page")
|
| 2248 |
+
if key.endswith(("_l", "_r")): # alt_l, ctrl_l, shift_l.
|
| 2249 |
+
key = key[:-2]
|
| 2250 |
+
if sys.platform == "darwin" and key == "meta":
|
| 2251 |
+
# meta should be reported as command on mac
|
| 2252 |
+
key = "cmd"
|
| 2253 |
+
key = {
|
| 2254 |
+
"return": "enter",
|
| 2255 |
+
"prior": "pageup", # Used by tk.
|
| 2256 |
+
"next": "pagedown", # Used by tk.
|
| 2257 |
+
}.get(key, key)
|
| 2258 |
+
return key
|
| 2259 |
+
|
| 2260 |
+
|
| 2261 |
+
@functools.cache
|
| 2262 |
+
def _make_class_factory(mixin_class, fmt, attr_name=None):
|
| 2263 |
+
"""
|
| 2264 |
+
Return a function that creates picklable classes inheriting from a mixin.
|
| 2265 |
+
|
| 2266 |
+
After ::
|
| 2267 |
+
|
| 2268 |
+
factory = _make_class_factory(FooMixin, fmt, attr_name)
|
| 2269 |
+
FooAxes = factory(Axes)
|
| 2270 |
+
|
| 2271 |
+
``Foo`` is a class that inherits from ``FooMixin`` and ``Axes`` and **is
|
| 2272 |
+
picklable** (picklability is what differentiates this from a plain call to
|
| 2273 |
+
`type`). Its ``__name__`` is set to ``fmt.format(Axes.__name__)`` and the
|
| 2274 |
+
base class is stored in the ``attr_name`` attribute, if not None.
|
| 2275 |
+
|
| 2276 |
+
Moreover, the return value of ``factory`` is memoized: calls with the same
|
| 2277 |
+
``Axes`` class always return the same subclass.
|
| 2278 |
+
"""
|
| 2279 |
+
|
| 2280 |
+
@functools.cache
|
| 2281 |
+
def class_factory(axes_class):
|
| 2282 |
+
# if we have already wrapped this class, declare victory!
|
| 2283 |
+
if issubclass(axes_class, mixin_class):
|
| 2284 |
+
return axes_class
|
| 2285 |
+
|
| 2286 |
+
# The parameter is named "axes_class" for backcompat but is really just
|
| 2287 |
+
# a base class; no axes semantics are used.
|
| 2288 |
+
base_class = axes_class
|
| 2289 |
+
|
| 2290 |
+
class subcls(mixin_class, base_class):
|
| 2291 |
+
# Better approximation than __module__ = "matplotlib.cbook".
|
| 2292 |
+
__module__ = mixin_class.__module__
|
| 2293 |
+
|
| 2294 |
+
def __reduce__(self):
|
| 2295 |
+
return (_picklable_class_constructor,
|
| 2296 |
+
(mixin_class, fmt, attr_name, base_class),
|
| 2297 |
+
self.__getstate__())
|
| 2298 |
+
|
| 2299 |
+
subcls.__name__ = subcls.__qualname__ = fmt.format(base_class.__name__)
|
| 2300 |
+
if attr_name is not None:
|
| 2301 |
+
setattr(subcls, attr_name, base_class)
|
| 2302 |
+
return subcls
|
| 2303 |
+
|
| 2304 |
+
class_factory.__module__ = mixin_class.__module__
|
| 2305 |
+
return class_factory
|
| 2306 |
+
|
| 2307 |
+
|
| 2308 |
+
def _picklable_class_constructor(mixin_class, fmt, attr_name, base_class):
|
| 2309 |
+
"""Internal helper for _make_class_factory."""
|
| 2310 |
+
factory = _make_class_factory(mixin_class, fmt, attr_name)
|
| 2311 |
+
cls = factory(base_class)
|
| 2312 |
+
return cls.__new__(cls)
|
| 2313 |
+
|
| 2314 |
+
|
| 2315 |
+
def _is_torch_array(x):
|
| 2316 |
+
"""Return whether *x* is a PyTorch Tensor."""
|
| 2317 |
+
try:
|
| 2318 |
+
# We're intentionally not attempting to import torch. If somebody
|
| 2319 |
+
# has created a torch array, torch should already be in sys.modules.
|
| 2320 |
+
tp = sys.modules.get("torch").Tensor
|
| 2321 |
+
except AttributeError:
|
| 2322 |
+
return False # Module not imported or a nonstandard module with no Tensor attr.
|
| 2323 |
+
return (isinstance(tp, type) # Just in case it's a very nonstandard module.
|
| 2324 |
+
and isinstance(x, tp))
|
| 2325 |
+
|
| 2326 |
+
|
| 2327 |
+
def _is_jax_array(x):
|
| 2328 |
+
"""Return whether *x* is a JAX Array."""
|
| 2329 |
+
try:
|
| 2330 |
+
# We're intentionally not attempting to import jax. If somebody
|
| 2331 |
+
# has created a jax array, jax should already be in sys.modules.
|
| 2332 |
+
tp = sys.modules.get("jax").Array
|
| 2333 |
+
except AttributeError:
|
| 2334 |
+
return False # Module not imported or a nonstandard module with no Array attr.
|
| 2335 |
+
return (isinstance(tp, type) # Just in case it's a very nonstandard module.
|
| 2336 |
+
and isinstance(x, tp))
|
| 2337 |
+
|
| 2338 |
+
|
| 2339 |
+
def _is_pandas_dataframe(x):
|
| 2340 |
+
"""Check if *x* is a Pandas DataFrame."""
|
| 2341 |
+
try:
|
| 2342 |
+
# We're intentionally not attempting to import Pandas. If somebody
|
| 2343 |
+
# has created a Pandas DataFrame, Pandas should already be in sys.modules.
|
| 2344 |
+
tp = sys.modules.get("pandas").DataFrame
|
| 2345 |
+
except AttributeError:
|
| 2346 |
+
return False # Module not imported or a nonstandard module with no Array attr.
|
| 2347 |
+
return (isinstance(tp, type) # Just in case it's a very nonstandard module.
|
| 2348 |
+
and isinstance(x, tp))
|
| 2349 |
+
|
| 2350 |
+
|
| 2351 |
+
def _is_tensorflow_array(x):
|
| 2352 |
+
"""Return whether *x* is a TensorFlow Tensor or Variable."""
|
| 2353 |
+
try:
|
| 2354 |
+
# We're intentionally not attempting to import TensorFlow. If somebody
|
| 2355 |
+
# has created a TensorFlow array, TensorFlow should already be in
|
| 2356 |
+
# sys.modules we use `is_tensor` to not depend on the class structure
|
| 2357 |
+
# of TensorFlow arrays, as `tf.Variables` are not instances of
|
| 2358 |
+
# `tf.Tensor` (they both convert the same way).
|
| 2359 |
+
is_tensor = sys.modules.get("tensorflow").is_tensor
|
| 2360 |
+
except AttributeError:
|
| 2361 |
+
return False
|
| 2362 |
+
try:
|
| 2363 |
+
return is_tensor(x)
|
| 2364 |
+
except Exception:
|
| 2365 |
+
return False # Just in case it's a very nonstandard module.
|
| 2366 |
+
|
| 2367 |
+
|
| 2368 |
+
def _unpack_to_numpy(x):
|
| 2369 |
+
"""Internal helper to extract data from e.g. pandas and xarray objects."""
|
| 2370 |
+
if isinstance(x, np.ndarray):
|
| 2371 |
+
# If numpy, return directly
|
| 2372 |
+
return x
|
| 2373 |
+
if hasattr(x, 'to_numpy'):
|
| 2374 |
+
# Assume that any to_numpy() method actually returns a numpy array
|
| 2375 |
+
return x.to_numpy()
|
| 2376 |
+
if hasattr(x, 'values'):
|
| 2377 |
+
xtmp = x.values
|
| 2378 |
+
# For example a dict has a 'values' attribute, but it is not a property
|
| 2379 |
+
# so in this case we do not want to return a function
|
| 2380 |
+
if isinstance(xtmp, np.ndarray):
|
| 2381 |
+
return xtmp
|
| 2382 |
+
if _is_torch_array(x) or _is_jax_array(x) or _is_tensorflow_array(x):
|
| 2383 |
+
# using np.asarray() instead of explicitly __array__(), as the latter is
|
| 2384 |
+
# only _one_ of many methods, and it's the last resort, see also
|
| 2385 |
+
# https://numpy.org/devdocs/user/basics.interoperability.html#using-arbitrary-objects-in-numpy
|
| 2386 |
+
# therefore, let arrays do better if they can
|
| 2387 |
+
xtmp = np.asarray(x)
|
| 2388 |
+
|
| 2389 |
+
# In case np.asarray method does not return a numpy array in future
|
| 2390 |
+
if isinstance(xtmp, np.ndarray):
|
| 2391 |
+
return xtmp
|
| 2392 |
+
return x
|
| 2393 |
+
|
| 2394 |
+
|
| 2395 |
+
def _auto_format_str(fmt, value):
|
| 2396 |
+
"""
|
| 2397 |
+
Apply *value* to the format string *fmt*.
|
| 2398 |
+
|
| 2399 |
+
This works both with unnamed %-style formatting and
|
| 2400 |
+
unnamed {}-style formatting. %-style formatting has priority.
|
| 2401 |
+
If *fmt* is %-style formattable that will be used. Otherwise,
|
| 2402 |
+
{}-formatting is applied. Strings without formatting placeholders
|
| 2403 |
+
are passed through as is.
|
| 2404 |
+
|
| 2405 |
+
Examples
|
| 2406 |
+
--------
|
| 2407 |
+
>>> _auto_format_str('%.2f m', 0.2)
|
| 2408 |
+
'0.20 m'
|
| 2409 |
+
>>> _auto_format_str('{} m', 0.2)
|
| 2410 |
+
'0.2 m'
|
| 2411 |
+
>>> _auto_format_str('const', 0.2)
|
| 2412 |
+
'const'
|
| 2413 |
+
>>> _auto_format_str('%d or {}', 0.2)
|
| 2414 |
+
'0 or {}'
|
| 2415 |
+
"""
|
| 2416 |
+
try:
|
| 2417 |
+
return fmt % (value,)
|
| 2418 |
+
except (TypeError, ValueError):
|
| 2419 |
+
return fmt.format(value)
|
Scripts_Climate_n_LAI_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/cbook.pyi
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import collections.abc
|
| 2 |
+
from collections.abc import Callable, Collection, Generator, Iterable, Iterator
|
| 3 |
+
import contextlib
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from matplotlib.artist import Artist
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
from numpy.typing import ArrayLike
|
| 11 |
+
|
| 12 |
+
from typing import (
|
| 13 |
+
Any,
|
| 14 |
+
Generic,
|
| 15 |
+
IO,
|
| 16 |
+
Literal,
|
| 17 |
+
TypeVar,
|
| 18 |
+
overload,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
_T = TypeVar("_T")
|
| 22 |
+
|
| 23 |
+
def _get_running_interactive_framework() -> str | None: ...
|
| 24 |
+
|
| 25 |
+
class CallbackRegistry:
|
| 26 |
+
exception_handler: Callable[[Exception], Any]
|
| 27 |
+
callbacks: dict[Any, dict[int, Any]]
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
exception_handler: Callable[[Exception], Any] | None = ...,
|
| 31 |
+
*,
|
| 32 |
+
signals: Iterable[Any] | None = ...,
|
| 33 |
+
) -> None: ...
|
| 34 |
+
def connect(self, signal: Any, func: Callable) -> int: ...
|
| 35 |
+
def disconnect(self, cid: int) -> None: ...
|
| 36 |
+
def process(self, s: Any, *args, **kwargs) -> None: ...
|
| 37 |
+
def blocked(
|
| 38 |
+
self, *, signal: Any | None = ...
|
| 39 |
+
) -> contextlib.AbstractContextManager[None]: ...
|
| 40 |
+
|
| 41 |
+
class silent_list(list[_T]):
|
| 42 |
+
type: str | None
|
| 43 |
+
def __init__(self, type: str | None, seq: Iterable[_T] | None = ...) -> None: ...
|
| 44 |
+
|
| 45 |
+
def strip_math(s: str) -> str: ...
|
| 46 |
+
def is_writable_file_like(obj: Any) -> bool: ...
|
| 47 |
+
def file_requires_unicode(x: Any) -> bool: ...
|
| 48 |
+
@overload
|
| 49 |
+
def to_filehandle(
|
| 50 |
+
fname: str | os.PathLike | IO,
|
| 51 |
+
flag: str = ...,
|
| 52 |
+
return_opened: Literal[False] = ...,
|
| 53 |
+
encoding: str | None = ...,
|
| 54 |
+
) -> IO: ...
|
| 55 |
+
@overload
|
| 56 |
+
def to_filehandle(
|
| 57 |
+
fname: str | os.PathLike | IO,
|
| 58 |
+
flag: str,
|
| 59 |
+
return_opened: Literal[True],
|
| 60 |
+
encoding: str | None = ...,
|
| 61 |
+
) -> tuple[IO, bool]: ...
|
| 62 |
+
@overload
|
| 63 |
+
def to_filehandle(
|
| 64 |
+
fname: str | os.PathLike | IO,
|
| 65 |
+
*, # if flag given, will match previous sig
|
| 66 |
+
return_opened: Literal[True],
|
| 67 |
+
encoding: str | None = ...,
|
| 68 |
+
) -> tuple[IO, bool]: ...
|
| 69 |
+
def open_file_cm(
|
| 70 |
+
path_or_file: str | os.PathLike | IO,
|
| 71 |
+
mode: str = ...,
|
| 72 |
+
encoding: str | None = ...,
|
| 73 |
+
) -> contextlib.AbstractContextManager[IO]: ...
|
| 74 |
+
def is_scalar_or_string(val: Any) -> bool: ...
|
| 75 |
+
@overload
|
| 76 |
+
def get_sample_data(
|
| 77 |
+
fname: str | os.PathLike, asfileobj: Literal[True] = ...
|
| 78 |
+
) -> np.ndarray | IO: ...
|
| 79 |
+
@overload
|
| 80 |
+
def get_sample_data(fname: str | os.PathLike, asfileobj: Literal[False]) -> str: ...
|
| 81 |
+
def _get_data_path(*args: Path | str) -> Path: ...
|
| 82 |
+
def flatten(
|
| 83 |
+
seq: Iterable[Any], scalarp: Callable[[Any], bool] = ...
|
| 84 |
+
) -> Generator[Any, None, None]: ...
|
| 85 |
+
|
| 86 |
+
class _Stack(Generic[_T]):
|
| 87 |
+
def __init__(self) -> None: ...
|
| 88 |
+
def clear(self) -> None: ...
|
| 89 |
+
def __call__(self) -> _T: ...
|
| 90 |
+
def __len__(self) -> int: ...
|
| 91 |
+
def __getitem__(self, ind: int) -> _T: ...
|
| 92 |
+
def forward(self) -> _T: ...
|
| 93 |
+
def back(self) -> _T: ...
|
| 94 |
+
def push(self, o: _T) -> _T: ...
|
| 95 |
+
def home(self) -> _T: ...
|
| 96 |
+
|
| 97 |
+
def safe_masked_invalid(x: ArrayLike, copy: bool = ...) -> np.ndarray: ...
|
| 98 |
+
def print_cycles(
|
| 99 |
+
objects: Iterable[Any], outstream: IO = ..., show_progress: bool = ...
|
| 100 |
+
) -> None: ...
|
| 101 |
+
|
| 102 |
+
class Grouper(Generic[_T]):
|
| 103 |
+
def __init__(self, init: Iterable[_T] = ...) -> None: ...
|
| 104 |
+
def __contains__(self, item: _T) -> bool: ...
|
| 105 |
+
def join(self, a: _T, *args: _T) -> None: ...
|
| 106 |
+
def joined(self, a: _T, b: _T) -> bool: ...
|
| 107 |
+
def remove(self, a: _T) -> None: ...
|
| 108 |
+
def __iter__(self) -> Iterator[list[_T]]: ...
|
| 109 |
+
def get_siblings(self, a: _T) -> list[_T]: ...
|
| 110 |
+
|
| 111 |
+
class GrouperView(Generic[_T]):
|
| 112 |
+
def __init__(self, grouper: Grouper[_T]) -> None: ...
|
| 113 |
+
def __contains__(self, item: _T) -> bool: ...
|
| 114 |
+
def __iter__(self) -> Iterator[list[_T]]: ...
|
| 115 |
+
def joined(self, a: _T, b: _T) -> bool: ...
|
| 116 |
+
def get_siblings(self, a: _T) -> list[_T]: ...
|
| 117 |
+
|
| 118 |
+
def simple_linear_interpolation(a: ArrayLike, steps: int) -> np.ndarray: ...
|
| 119 |
+
def delete_masked_points(*args): ...
|
| 120 |
+
def _broadcast_with_masks(*args: ArrayLike, compress: bool = ...) -> list[ArrayLike]: ...
|
| 121 |
+
def boxplot_stats(
|
| 122 |
+
X: ArrayLike,
|
| 123 |
+
whis: float | tuple[float, float] = ...,
|
| 124 |
+
bootstrap: int | None = ...,
|
| 125 |
+
labels: ArrayLike | None = ...,
|
| 126 |
+
autorange: bool = ...,
|
| 127 |
+
) -> list[dict[str, Any]]: ...
|
| 128 |
+
|
| 129 |
+
ls_mapper: dict[str, str]
|
| 130 |
+
ls_mapper_r: dict[str, str]
|
| 131 |
+
|
| 132 |
+
def contiguous_regions(mask: ArrayLike) -> list[np.ndarray]: ...
|
| 133 |
+
def is_math_text(s: str) -> bool: ...
|
| 134 |
+
def violin_stats(
|
| 135 |
+
X: ArrayLike, method: Callable, points: int = ..., quantiles: ArrayLike | None = ...
|
| 136 |
+
) -> list[dict[str, Any]]: ...
|
| 137 |
+
def pts_to_prestep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ...
|
| 138 |
+
def pts_to_poststep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ...
|
| 139 |
+
def pts_to_midstep(x: np.ndarray, *args: np.ndarray) -> np.ndarray: ...
|
| 140 |
+
|
| 141 |
+
STEP_LOOKUP_MAP: dict[str, Callable]
|
| 142 |
+
|
| 143 |
+
def index_of(y: float | ArrayLike) -> tuple[np.ndarray, np.ndarray]: ...
|
| 144 |
+
def safe_first_element(obj: Collection[_T]) -> _T: ...
|
| 145 |
+
def sanitize_sequence(data): ...
|
| 146 |
+
def normalize_kwargs(
|
| 147 |
+
kw: dict[str, Any],
|
| 148 |
+
alias_mapping: dict[str, list[str]] | type[Artist] | Artist | None = ...,
|
| 149 |
+
) -> dict[str, Any]: ...
|
| 150 |
+
def _lock_path(path: str | os.PathLike) -> contextlib.AbstractContextManager[None]: ...
|
| 151 |
+
def _str_equal(obj: Any, s: str) -> bool: ...
|
| 152 |
+
def _str_lower_equal(obj: Any, s: str) -> bool: ...
|
| 153 |
+
def _array_perimeter(arr: np.ndarray) -> np.ndarray: ...
|
| 154 |
+
def _unfold(arr: np.ndarray, axis: int, size: int, step: int) -> np.ndarray: ...
|
| 155 |
+
def _array_patch_perimeters(x: np.ndarray, rstride: int, cstride: int) -> np.ndarray: ...
|
| 156 |
+
def _setattr_cm(obj: Any, **kwargs) -> contextlib.AbstractContextManager[None]: ...
|
| 157 |
+
|
| 158 |
+
class _OrderedSet(collections.abc.MutableSet):
|
| 159 |
+
def __init__(self) -> None: ...
|
| 160 |
+
def __contains__(self, key) -> bool: ...
|
| 161 |
+
def __iter__(self): ...
|
| 162 |
+
def __len__(self) -> int: ...
|
| 163 |
+
def add(self, key) -> None: ...
|
| 164 |
+
def discard(self, key) -> None: ...
|
| 165 |
+
|
| 166 |
+
def _setup_new_guiapp() -> None: ...
|
| 167 |
+
def _format_approx(number: float, precision: int) -> str: ...
|
| 168 |
+
def _g_sig_digits(value: float, delta: float) -> int: ...
|
| 169 |
+
def _unikey_or_keysym_to_mplkey(unikey: str, keysym: str) -> str: ...
|
| 170 |
+
def _is_torch_array(x: Any) -> bool: ...
|
| 171 |
+
def _is_jax_array(x: Any) -> bool: ...
|
| 172 |
+
def _unpack_to_numpy(x: Any) -> Any: ...
|
| 173 |
+
def _auto_format_str(fmt: str, value: Any) -> str: ...
|