|
2 | 2 | Autoscaling
|
3 | 3 | ===========
|
4 | 4 |
|
5 |
| -The limits on an axis can be set manually (e.g. ``ax.set_xlim(xmin, xmax)``) or Matplotlib can set them automatically based on the data already on the axes. There are a number of options to this autoscaling behaviour, discussed below. |
| 5 | +The limits on an axis can be set manually (e.g. ``ax.set_xlim(xmin, xmax)``) |
| 6 | +or Matplotlib can set them automatically based on the data already on the axes. |
| 7 | +There are a number of options to this autoscaling behaviour, discussed below. |
6 | 8 | """
|
7 | 9 |
|
8 | 10 | ###############################################################################
|
|
36 | 38 | fig.show()
|
37 | 39 |
|
38 | 40 | ###############################################################################
|
39 |
| -# In general, margins can be in the range (-0.5, ∞), where negative margins set the axes limits to |
40 |
| -# a fraction of the data range, and allow a zoom effect. Using a single number for margins |
41 |
| -# affects both axes, a single margin can be customized using keyword |
42 |
| -# arguments ``x`` or ``y``, but positional and keyword interface cannot be |
43 |
| -# combined |
| 41 | +# In general, margins can be in the range (-0.5, ∞), where negative margins set |
| 42 | +# the axes limits to a fraction of the data range, and allow a zoom effect. |
| 43 | +# Using a single number for margins affects both axes, a single margin can be |
| 44 | +# customized using keyword arguments ``x`` or ``y``, but positional and keyword |
| 45 | +# interface cannot be combined. |
44 | 46 |
|
45 | 47 | fig, ax = plt.subplots()
|
46 | 48 | ax.plot(x, y)
|
47 | 49 | ax.margins(y=-0.2)
|
48 | 50 | fig.show()
|
49 | 51 |
|
50 | 52 | ###############################################################################
|
51 |
| -# |
52 |
| -# |
53 | 53 | # Sticky edges
|
54 | 54 | # ------------
|
55 | 55 | # Some :class:`.Artist` objects do not allow margins. For example, setting
|
|
71 | 71 | # This override of margins is determined by "sticky edges", a
|
72 | 72 | # property of :class:`.Artist` class that can suppress adding margins to axis
|
73 | 73 | # limits. The effect of sticky edges can be disabled on an Axes by changing
|
74 |
| -# `~matplotlib.axes.Axes.use_sticky_edges`. |
| 74 | +# `~matplotlib.axes.Axes.use_sticky_edges`. |
75 | 75 | # Artists have a property `.Artist.sticky_edges`, and the values of
|
76 | 76 | # sticky edges can be changed by writing to ``Artist.sticky_edges.x`` or
|
77 | 77 | # ``.Artist.sticky_edges.y``.
|
|
160 | 160 | ###############################################################################
|
161 | 161 | # Working with collections
|
162 | 162 | # ------------------------
|
| 163 | +# |
163 | 164 | # Autoscale works out of the box for all lines, patches, and images added to
|
164 | 165 | # the axes. One of the artists that it won't work with is a `.Collection`.
|
165 | 166 | # After adding a collection to the axes, one has to manually trigger the
|
|
0 commit comments