0
# Tick Control and Formatting
1
2
Advanced tick locator and formatter system with support for scientific notation, fractions, geographic coordinates, and custom number formatting patterns. Proplot provides enhanced tick control with specialized formatters and locators for scientific and geographic applications.
3
4
## Capabilities
5
6
### Formatter Classes
7
8
```python { .api }
9
class AutoFormatter:
10
"""Automatic number formatting with flexible precision."""
11
12
class SciFormatter:
13
"""Format numbers with scientific notation."""
14
15
class SigFigFormatter:
16
"""Format numbers to specified significant figures."""
17
18
class SimpleFormatter:
19
"""Format numbers with flexible precision and features."""
20
21
class FracFormatter:
22
"""Format numbers as fractions or multiples."""
23
24
class DegreeFormatter:
25
"""Format numbers as geographic coordinates."""
26
27
class LongitudeFormatter:
28
"""Format longitude coordinates with E/W designations."""
29
30
class LatitudeFormatter:
31
"""Format latitude coordinates with N/S designations."""
32
```
33
34
### Locator Classes
35
36
```python { .api }
37
class DegreeLocator:
38
"""Locate degree coordinates with customizable spacing."""
39
40
class LongitudeLocator:
41
"""Locate longitude coordinates."""
42
43
class LatitudeLocator:
44
"""Locate latitude coordinates."""
45
```
46
47
### Constructor Functions
48
49
```python { .api }
50
def Locator(*args, **kwargs):
51
"""
52
Construct tick locator instances.
53
54
Parameters:
55
- locator (str/Locator): Locator specification
56
- **kwargs: Locator-specific parameters
57
58
Returns:
59
Locator: Matplotlib locator instance
60
"""
61
62
def Formatter(*args, **kwargs):
63
"""
64
Construct tick formatter instances.
65
66
Parameters:
67
- formatter (str/Formatter): Formatter specification
68
- **kwargs: Formatter-specific parameters
69
70
Returns:
71
Formatter: Matplotlib formatter instance
72
"""
73
```
74
75
## Usage Examples
76
77
```python
78
import proplot as pplt
79
80
# Scientific notation
81
fig, ax = pplt.subplots()
82
ax.format(yformatter='sci', yformatter_kw={'precision': 2})
83
84
# Geographic coordinates
85
fig, ax = pplt.subplots(proj='platecarree')
86
ax.format(
87
lonformatter='deglon', # Longitude with E/W
88
latformatter='deglat', # Latitude with N/S
89
lonlocator=pplt.Locator('deglon', dms=False),
90
latlocator=pplt.Locator('deglat', dms=False)
91
)
92
93
# Fraction formatting
94
ax.format(xformatter='frac', xformatter_kw={'symbol': 'π'})
95
```