or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

axes-plotting.mdcolors-colormaps.mdconfiguration.mddemonstrations.mdfigure-subplots.mdindex.mdprojections.mdscales.mdtick-control.mdutilities.md

scales.mddocs/

0

# Scales and Transformations

1

2

Comprehensive axis scaling system including logarithmic, power, inverse, and custom scales with seamless integration into matplotlib's transformation pipeline. Proplot extends matplotlib's scale system with additional scales and enhanced functionality.

3

4

## Capabilities

5

6

### Built-in Scale Classes

7

8

```python { .api }

9

class LinearScale:

10

"""Linear axis scaling (default)."""

11

12

class LogScale:

13

"""Logarithmic axis scaling."""

14

15

class SymmetricalLogScale:

16

"""Symmetric logarithmic scaling for data crossing zero."""

17

18

class LogitScale:

19

"""Logit scaling for probability data."""

20

21

class PowerScale:

22

"""Power law scaling with configurable exponent."""

23

24

class InverseScale:

25

"""Inverse scaling (1/x transformation)."""

26

27

class ExpScale:

28

"""Exponential scaling."""

29

30

class CutoffScale:

31

"""Scale with arbitrary cutoff points for piecewise linear scaling."""

32

33

class FuncScale:

34

"""Scale with arbitrary forward and inverse functions."""

35

36

class SineLatitudeScale:

37

"""Sine latitude scaling for geographic data."""

38

39

class MercatorLatitudeScale:

40

"""Mercator latitude scaling for geographic projections."""

41

```

42

43

### Scale Constructor

44

45

```python { .api }

46

def Scale(*args, **kwargs):

47

"""

48

Construct axis scale instances from various specifications.

49

50

Parameters:

51

- scale (str): Scale name ('linear', 'log', 'symlog', 'power', etc.)

52

- **kwargs: Scale-specific parameters

53

54

Scale Types:

55

- 'linear': Linear scaling

56

- 'log': Logarithmic scaling

57

- 'symlog': Symmetric logarithmic scaling

58

- 'logit': Logit scaling for probabilities

59

- 'power': Power law scaling

60

- 'inverse': Inverse (1/x) scaling

61

- 'exp': Exponential scaling

62

- 'cutoff': Piecewise linear with cutoffs

63

- 'func': Custom function scaling

64

- 'sine': Sine latitude scaling

65

- 'mercator': Mercator latitude scaling

66

67

Returns:

68

Scale: Appropriate scale instance

69

"""

70

```

71

72

## Usage Examples

73

74

```python

75

import proplot as pplt

76

import numpy as np

77

78

# Logarithmic scaling

79

fig, ax = pplt.subplots()

80

ax.plot(x, y)

81

ax.format(yscale='log')

82

83

# Power scaling

84

ax.format(xscale='power', xscale_kw={'power': 0.5})

85

86

# Custom function scaling

87

from proplot import FuncScale

88

scale = FuncScale(lambda x: x**2, lambda x: np.sqrt(x))

89

ax.format(yscale=scale)

90

91

# Cutoff scaling for multi-range data

92

ax.format(yscale='cutoff', yscale_kw={'cutoffs': [1, 10, 100]})

93

```