-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy path__init__.py
More file actions
47 lines (44 loc) · 1.44 KB
/
__init__.py
File metadata and controls
47 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
"""
The various axes classes used throughout ultraplot.
"""
import matplotlib.projections as mproj
from ..internals import context
from .base import Axes # noqa: F401
from .cartesian import CartesianAxes
from .container import ExternalAxesContainer # noqa: F401
from .geo import (
GeoAxes, # noqa: F401
_BasemapAxes,
_CartopyAxes,
)
from .plot import PlotAxes # noqa: F401
from .polar import PolarAxes
from .shared import _SharedAxes # noqa: F401
from .three import ThreeAxes # noqa: F401
# Prevent importing module names and set order of appearance for objects
__all__ = [
"Axes",
"PlotAxes",
"CartesianAxes",
"PolarAxes",
"GeoAxes",
"ThreeAxes",
"ExternalAxesContainer",
]
# Register projections with package prefix to avoid conflicts
# NOTE: We integrate with cartopy and basemap rather than using matplotlib's
# native projection system. Therefore axes names are not part of public API.
_cls_dict = {} # track valid names
for _cls in (CartesianAxes, PolarAxes, _CartopyAxes, _BasemapAxes, ThreeAxes):
for _name in (_cls._name, *_cls._name_aliases):
with context._state_context(_cls, name="ultraplot_" + _name):
mproj.register_projection(_cls)
_cls_dict[_name] = _cls
_cls_table = "\n".join(
" "
+ key
+ " " * (max(map(len, _cls_dict)) - len(key) + 7)
+ ("GeoAxes" if cls.__name__[:1] == "_" else cls.__name__)
for key, cls in _cls_dict.items()
)