|
| 1 | + |
| 2 | +What's new in Matplotlib 3.2 |
| 3 | +============================ |
| 4 | + |
| 5 | +For a list of all of the issues and pull requests since the last |
| 6 | +revision, see the :ref:`github-stats`. |
| 7 | + |
| 8 | +.. contents:: Table of Contents |
| 9 | + :depth: 4 |
| 10 | + |
| 11 | +.. toctree:: |
| 12 | + :maxdepth: 4 |
| 13 | + |
| 14 | + |
| 15 | +Unit converters and subclasses |
| 16 | +------------------------------ |
| 17 | +Unit converters now also handle instances of subclasses of the class they have |
| 18 | +been registered for. |
| 19 | + |
| 20 | +`~pyplot.imsave` metadata and PIL options |
| 21 | +----------------------------------------- |
| 22 | +`~pyplot.imsave` has gained support for the ``metadata`` and ``pil_kwargs`` |
| 23 | +parameters. These parameters behave similarly as for the `Figure.savefig()` |
| 24 | +method. |
| 25 | + |
| 26 | +`cbook.normalize_kwargs` |
| 27 | +------------------------ |
| 28 | +`cbook.normalize_kwargs` now presents a convenient interface to normalize |
| 29 | +artist properties (e.g., from "lw" to "linewidth"): |
| 30 | + |
| 31 | +>>> cbook.normalize_kwargs({"lw": 1}, Line2D) |
| 32 | +{"linewidth": 1} |
| 33 | + |
| 34 | +The first argument is the mapping to be normalized, and the second argument can |
| 35 | +be an artist class or an artist instance (it can also be a mapping in a |
| 36 | +specific format; see the function's docstring for details). |
| 37 | + |
| 38 | +`FontProperties` and `os.PathLike` |
| 39 | +---------------------------------- |
| 40 | +The *fname* argument to `FontProperties` can now be an `os.PathLike`\s |
| 41 | +e.g. ``FontProperties(fname=pathlib.Path("/path/to/font.ttf"))``. |
| 42 | + |
| 43 | +Gouraud-shading alpha channel in PDF backend |
| 44 | +-------------------------------------------- |
| 45 | +The pdf backend now supports an alpha channel in Gouraud-shaded |
| 46 | +triangle meshes. |
| 47 | + |
| 48 | +Kerning adjustments now use correct values |
| 49 | +------------------------------------------ |
| 50 | +Due to an error in how kerning adjustments were applied, previous versions of |
| 51 | +Matplotlib would under-correct kerning. This version will now correctly apply |
| 52 | +kerning (for fonts supported by FreeType). To restore the old behavior (e.g., |
| 53 | +for test images), you may set :rc:`text.kerning_factor` to 6 (instead of 0). |
| 54 | +Other values have undefined behavior. |
| 55 | + |
| 56 | +.. plot:: |
| 57 | + |
| 58 | + import matplotlib.pyplot as plt |
| 59 | + |
| 60 | + # Use old kerning values: |
| 61 | + plt.rcParams['text.kerning_factor'] = 6 |
| 62 | + fig, ax = plt.subplots() |
| 63 | + ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56) |
| 64 | + ax.set_title('Before (text.kerning_factor = 6)') |
| 65 | + |
| 66 | +Note how the spacing between characters is uniform between their bounding boxes |
| 67 | +(above). With corrected kerning (below), slanted characters (e.g., AV or VA) |
| 68 | +will be spaced closer together, as well as various other character pairs, |
| 69 | +depending on font support (e.g., T and e, or the period after the W). |
| 70 | + |
| 71 | +.. plot:: |
| 72 | + |
| 73 | + import matplotlib.pyplot as plt |
| 74 | + |
| 75 | + # Use new kerning values: |
| 76 | + plt.rcParams['text.kerning_factor'] = 0 |
| 77 | + fig, ax = plt.subplots() |
| 78 | + ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56) |
| 79 | + ax.set_title('After (text.kerning_factor = 0)') |
| 80 | + |
| 81 | + |
| 82 | +bar3d lightsource shading |
| 83 | +------------------------- |
| 84 | +bar3d now supports lighting from different angles when the *shade* parameter is |
| 85 | +True, which can be configured using the ``lightsource`` parameter. |
| 86 | + |
| 87 | +Shifting errorbars |
| 88 | +------------------ |
| 89 | +Previously, `plt.errorbar()` accepted a kwarg `errorevery` such that the |
| 90 | +command `plt.errorbar(x, y, yerr, errorevery=6)` would add error bars to |
| 91 | +datapoints `x[::6], y[::6]`. |
| 92 | + |
| 93 | +`errorbar()` now also accepts a tuple for `errorevery` such that |
| 94 | +`plt.errorbar(x, y, yerr, errorevery=(start, N))` adds error bars to points |
| 95 | +`x[start::N], y[start::N]`. |
| 96 | + |
| 97 | +Improvements in Logit scale ticker and formatter |
| 98 | +------------------------------------------------ |
| 99 | +Introduced in version 1.5, the logit scale didn't have an appropriate ticker and |
| 100 | +formatter. Previously, the location of ticks was not zoom dependent, too many labels |
| 101 | +were displayed causing overlapping which broke readability, and label formatting |
| 102 | +did not adapt to precision. |
| 103 | + |
| 104 | +Starting from this version, the logit locator has nearly the same behavior as the |
| 105 | +locator for the log scale or the linear |
| 106 | +scale, depending on used zoom. The number of ticks is controlled. Some minor |
| 107 | +labels are displayed adaptively as sublabels in log scale. Formatting is adapted |
| 108 | +for probabilities and the precision adapts to the scale. |
| 109 | + |
| 110 | +rcParams for axes title location and color |
| 111 | +------------------------------------------ |
| 112 | +Two new rcParams have been added: ``axes.titlelocation`` denotes the default axes title |
| 113 | +alignment, and ``axes.titlecolor`` the default axes title color. |
| 114 | + |
| 115 | +Valid values for ``axes.titlelocation`` are: left, center, and right. |
| 116 | +Valid values for ``axes.titlecolor`` are: auto or a color. Setting it to auto |
| 117 | +will fall back to previous behaviour, which is using the color in ``text.color``. |
| 118 | + |
| 119 | +3-digit and 4-digit hex colors |
| 120 | +------------------------------ |
| 121 | +Colors can now be specified using 3-digit or 4-digit hex colors, shorthand for |
| 122 | +the colors obtained by duplicating each character, e.g. ``#123`` is equivalent to |
| 123 | +``#112233`` and ``#123a`` is equivalent to ``#112233aa``. |
0 commit comments