@@ -39,24 +39,23 @@ Adding a new scale consists of defining a subclass of
39
39
:class: `matplotlib.scale.ScaleBase `, that includes the following
40
40
elements:
41
41
42
- - A transformation from data coordinates into display coordinates.
42
+ - A transformation from data coordinates into display coordinates.
43
43
44
- - An inverse of that transformation. This is used, for example, to
45
- convert mouse positions from screen space back into data space.
44
+ - An inverse of that transformation. This is used, for example, to
45
+ convert mouse positions from screen space back into data space.
46
46
47
- - A function to limit the range of the axis to acceptable values
48
- (``limit_range_for_scale() ``). A log scale, for instance, would
49
- prevent the range from including values less than or equal to
50
- zero.
47
+ - A function to limit the range of the axis to acceptable values
48
+ (``limit_range_for_scale() ``). A log scale, for instance, would
49
+ prevent the range from including values less than or equal to zero.
51
50
52
- - Locators (major and minor) that determine where to place ticks in
53
- the plot, and optionally, how to adjust the limits of the plot to
54
- some "good" values. Unlike ``limit_range_for_scale() ``, which is
55
- always enforced, the range setting here is only used when
56
- automatically setting the range of the plot.
51
+ - Locators (major and minor) that determine where to place ticks in
52
+ the plot, and optionally, how to adjust the limits of the plot to
53
+ some "good" values. Unlike ``limit_range_for_scale() ``, which is
54
+ always enforced, the range setting here is only used when
55
+ automatically setting the range of the plot.
57
56
58
- - Formatters (major and minor) that specify how the tick labels
59
- should be drawn.
57
+ - Formatters (major and minor) that specify how the tick labels
58
+ should be drawn.
60
59
61
60
Once the class is defined, it must be registered with matplotlib so
62
61
that the user can select it.
@@ -75,51 +74,48 @@ Adding a new projection consists of defining a projection axes which
75
74
subclasses :class: `matplotlib.axes.Axes ` and includes the following
76
75
elements:
77
76
78
- - A transformation from data coordinates into display coordinates.
77
+ - A transformation from data coordinates into display coordinates.
79
78
80
- - An inverse of that transformation. This is used, for example, to
81
- convert mouse positions from screen space back into data space.
79
+ - An inverse of that transformation. This is used, for example, to
80
+ convert mouse positions from screen space back into data space.
82
81
83
- - Transformations for the gridlines, ticks and ticklabels. Custom
84
- projections will often need to place these elements in special
85
- locations, and matplotlib has a facility to help with doing so.
82
+ - Transformations for the gridlines, ticks and ticklabels. Custom
83
+ projections will often need to place these elements in special
84
+ locations, and matplotlib has a facility to help with doing so.
86
85
87
- - Setting up default values (overriding
88
- :meth: `~matplotlib.axes.Axes.cla `), since the defaults for a
89
- rectilinear axes may not be appropriate.
86
+ - Setting up default values (overriding :meth: `~matplotlib.axes.Axes.cla `),
87
+ since the defaults for a rectilinear axes may not be appropriate.
90
88
91
- - Defining the shape of the axes, for example, an elliptical axes,
92
- that will be used to draw the background of the plot and for
93
- clipping any data elements.
89
+ - Defining the shape of the axes, for example, an elliptical axes, that will be
90
+ used to draw the background of the plot and for clipping any data elements.
94
91
95
- - Defining custom locators and formatters for the projection. For
96
- example, in a geographic projection, it may be more convenient to
97
- display the grid in degrees, even if the data is in radians.
92
+ - Defining custom locators and formatters for the projection. For
93
+ example, in a geographic projection, it may be more convenient to
94
+ display the grid in degrees, even if the data is in radians.
98
95
99
- - Set up interactive panning and zooming. This is left as an
100
- "advanced" feature left to the reader, but there is an example of
101
- this for polar plots in :mod: `matplotlib.projections.polar `.
96
+ - Set up interactive panning and zooming. This is left as an
97
+ "advanced" feature left to the reader, but there is an example of
98
+ this for polar plots in :mod: `matplotlib.projections.polar `.
102
99
103
- - Any additional methods for additional convenience or features.
100
+ - Any additional methods for additional convenience or features.
104
101
105
102
Once the projection axes is defined, it can be used in one of two ways:
106
103
107
- - By defining the class attribute ``name ``, the projection axes can be
108
- registered with :func: `matplotlib.projections.register_projection `
109
- and subsequently simply invoked by name::
104
+ - By defining the class attribute ``name ``, the projection axes can be
105
+ registered with :func: `matplotlib.projections.register_projection `
106
+ and subsequently simply invoked by name::
110
107
111
- plt.axes(projection='my_proj_name')
108
+ plt.axes(projection='my_proj_name')
112
109
113
- - For more complex, parameterisable projections, a generic "projection"
114
- object may be defined which includes the method ``_as_mpl_axes ``.
115
- ``_as_mpl_axes `` should take no arguments and return the projection's
116
- axes subclass and a dictionary of additional arguments to pass to the
117
- subclass' ``__init__ `` method. Subsequently a parameterised projection
118
- can be initialised with::
110
+ - For more complex, parameterisable projections, a generic "projection" object
111
+ may be defined which includes the method ``_as_mpl_axes ``. ``_as_mpl_axes ``
112
+ should take no arguments and return the projection's axes subclass and a
113
+ dictionary of additional arguments to pass to the subclass' ``__init__ ``
114
+ method. Subsequently a parameterised projection can be initialised with::
119
115
120
- plt.axes(projection=MyProjection(param1=param1_value))
116
+ plt.axes(projection=MyProjection(param1=param1_value))
121
117
122
- where MyProjection is an object which implements a ``_as_mpl_axes `` method.
118
+ where MyProjection is an object which implements a ``_as_mpl_axes `` method.
123
119
124
120
125
121
A full-fledged and heavily annotated example is in
0 commit comments