diff --git a/doc/users/next_whats_new/3d_plot_aspects.rst b/doc/users/next_whats_new/3d_plot_aspects.rst deleted file mode 100644 index a65160b4face..000000000000 --- a/doc/users/next_whats_new/3d_plot_aspects.rst +++ /dev/null @@ -1,33 +0,0 @@ -Set equal aspect ratio for 3D plots ------------------------------------ - -Users can set the aspect ratio for the X, Y, Z axes of a 3D plot to be 'equal', -'equalxy', 'equalxz', or 'equalyz' rather than the default of 'auto'. - -.. plot:: - :include-source: true - - import matplotlib.pyplot as plt - import numpy as np - from itertools import combinations, product - - aspects = ('auto', 'equal', 'equalxy', 'equalyz', 'equalxz') - fig, axs = plt.subplots(1, len(aspects), subplot_kw={'projection': '3d'}) - - # Draw rectangular cuboid with side lengths [1, 1, 5] - r = [0, 1] - scale = np.array([1, 1, 5]) - pts = combinations(np.array(list(product(r, r, r))), 2) - for start, end in pts: - if np.sum(np.abs(start - end)) == r[1] - r[0]: - for ax in axs: - ax.plot3D(*zip(start*scale, end*scale), color='C0') - - # Set the aspect ratios - for i, ax in enumerate(axs): - ax.set_box_aspect((3, 4, 5)) - ax.set_aspect(aspects[i]) - ax.set_title(f"set_aspect('{aspects[i]}')") - - fig.set_size_inches(13, 3) - plt.show() diff --git a/doc/users/next_whats_new/3d_plot_focal_length.rst b/doc/users/next_whats_new/3d_plot_focal_length.rst deleted file mode 100644 index 41750851dc06..000000000000 --- a/doc/users/next_whats_new/3d_plot_focal_length.rst +++ /dev/null @@ -1,31 +0,0 @@ -Give the 3D camera a custom focal length ----------------------------------------- - -Users can now better mimic real-world cameras by specifying the focal length of -the virtual camera in 3D plots. The default focal length of 1 corresponds to a -Field of View (FOV) of 90 deg, and is backwards-compatible with existing 3D -plots. An increased focal length between 1 and infinity "flattens" the image, -while a decreased focal length between 1 and 0 exaggerates the perspective and -gives the image more apparent depth. - -The focal length can be calculated from a desired FOV via the equation: - -.. mathmpl:: - - focal\_length = 1/\tan(FOV/2) - -.. plot:: - :include-source: true - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from numpy import inf - fig, axs = plt.subplots(1, 3, subplot_kw={'projection': '3d'}) - X, Y, Z = axes3d.get_test_data(0.05) - focal_lengths = [0.2, 1, inf] - for ax, fl in zip(axs, focal_lengths): - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - ax.set_proj_type('persp', focal_length=fl) - ax.set_title(f"focal_length = {fl}") - fig.set_size_inches(10, 4) - plt.show() diff --git a/doc/users/next_whats_new/3d_plot_roll_angle.rst b/doc/users/next_whats_new/3d_plot_roll_angle.rst deleted file mode 100644 index 66674297077b..000000000000 --- a/doc/users/next_whats_new/3d_plot_roll_angle.rst +++ /dev/null @@ -1,22 +0,0 @@ -3D plots gained a 3rd "roll" viewing angle ------------------------------------------- - -3D plots can now be viewed from any orientation with the addition of a 3rd roll -angle, which rotates the plot about the viewing axis. Interactive rotation -using the mouse still only controls elevation and azimuth, meaning that this -feature is relevant to users who create more complex camera angles -programmatically. The default roll angle of 0 is backwards-compatible with -existing 3D plots. - -.. plot:: - :include-source: true - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - fig = plt.figure() - ax = fig.add_subplot(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - ax.view_init(elev=0, azim=0, roll=30) - ax.set_title('elev=0, azim=0, roll=30') - plt.show() diff --git a/doc/users/next_whats_new/asinh_scale.rst b/doc/users/next_whats_new/asinh_scale.rst deleted file mode 100644 index 69238ebe220a..000000000000 --- a/doc/users/next_whats_new/asinh_scale.rst +++ /dev/null @@ -1,32 +0,0 @@ -New axis scale ``asinh`` (experimental) ---------------------------------------- - -The new ``asinh`` axis scale offers an alternative to ``symlog`` that -smoothly transitions between the quasi-linear and asymptotically logarithmic -regions of the scale. This is based on an arcsinh transformation that -allows plotting both positive and negative values that span many orders -of magnitude. - -.. plot:: - - import matplotlib.pyplot as plt - import numpy as np - - fig, (ax0, ax1) = plt.subplots(1, 2, sharex=True) - x = np.linspace(-3, 6, 100) - - ax0.plot(x, x) - ax0.set_yscale('symlog') - ax0.grid() - ax0.set_title('symlog') - - ax1.plot(x, x) - ax1.set_yscale('asinh') - ax1.grid() - ax1.set_title(r'$sinh^{-1}$') - - for p in (-2, 2): - for ax in (ax0, ax1): - c = plt.Circle((p, p), radius=0.5, fill=False, - color='red', alpha=0.8, lw=3) - ax.add_patch(c) diff --git a/doc/users/next_whats_new/bar_plot_labels.rst b/doc/users/next_whats_new/bar_plot_labels.rst deleted file mode 100644 index 6da57a317f59..000000000000 --- a/doc/users/next_whats_new/bar_plot_labels.rst +++ /dev/null @@ -1,16 +0,0 @@ -Easier labelling of bars in bar plot ------------------------------------- - -The ``label`` argument of `~matplotlib.axes.Axes.bar` can now -be passed a list of labels for the bars. - -.. code-block:: python - - import matplotlib.pyplot as plt - - x = ["a", "b", "c"] - y = [10, 20, 15] - - fig, ax = plt.subplots() - bar_container = ax.barh(x, y, label=x) - [bar.get_label() for bar in bar_container] diff --git a/doc/users/next_whats_new/color_support_for_math_to_image.rst b/doc/users/next_whats_new/color_support_for_math_to_image.rst deleted file mode 100644 index 3c4f376349a6..000000000000 --- a/doc/users/next_whats_new/color_support_for_math_to_image.rst +++ /dev/null @@ -1,11 +0,0 @@ -``math_to_image`` now has a *color* keyword argument --------------------------------------------------------- - -To easily support external libraries that rely on the MathText rendering of -Matplotlib to generate equation images, a *color* keyword argument was added -to `~matplotlib.mathtext.math_to_image`. - -.. code-block:: python - - from matplotlib import mathtext - mathtext.math_to_image('$x^2$', 'filename.png', color='Maroon') diff --git a/doc/users/next_whats_new/custom_cap_widths.rst b/doc/users/next_whats_new/custom_cap_widths.rst deleted file mode 100644 index 137b9b6839f8..000000000000 --- a/doc/users/next_whats_new/custom_cap_widths.rst +++ /dev/null @@ -1,16 +0,0 @@ -Custom cap widths in box and whisker plots in bxp() and boxplot() ------------------------------------------------------------------ - -New bxp() and boxplot() parameter capwidths allows to control the -widths of the caps in box and whisker plots. - -.. plot:: - :include-source: true - - import matplotlib.pyplot as plt - import numpy as np - x = np.linspace(-7, 7, 140) - x = np.hstack([-25, x, 25]) - fig, ax = plt.subplots() - ax.boxplot([x, x], notch=True, capwidths=[0.01, 0.2]) - plt.show() diff --git a/doc/users/next_whats_new/double_quotes_matplolibrc.rst b/doc/users/next_whats_new/double_quotes_matplolibrc.rst deleted file mode 100644 index e40c1be750b2..000000000000 --- a/doc/users/next_whats_new/double_quotes_matplolibrc.rst +++ /dev/null @@ -1,10 +0,0 @@ -Double-quoted strings in matplotlibrc -------------------------------------- - -You can now use double-quotes around strings. This allows using the '#' -character in strings. Without quotes, '#' is interpreted as start of a comment. -In particular, you can now define hex-colors: - -.. code-block:: none - - grid.color: "#b0b0b0" diff --git a/doc/users/next_whats_new/extending_MarkerStyle.rst b/doc/users/next_whats_new/extending_MarkerStyle.rst deleted file mode 100644 index f31585a70b1c..000000000000 --- a/doc/users/next_whats_new/extending_MarkerStyle.rst +++ /dev/null @@ -1,19 +0,0 @@ -New customization of MarkerStyle --------------------------------- - -New MarkerStyle parameters allow control of join style and cap style, and for -the user to supply a transformation to be applied to the marker (e.g. a rotation). - -.. plot:: - :include-source: true - - import matplotlib.pyplot as plt - from matplotlib.markers import MarkerStyle - from matplotlib.transforms import Affine2D - fig, ax = plt.subplots(figsize=(6, 1)) - fig.suptitle('New markers', fontsize=14) - for col, (size, rot) in enumerate(zip([2, 5, 10], [0, 45, 90])): - t = Affine2D().rotate_deg(rot).scale(size) - ax.plot(col, 0, marker=MarkerStyle("*", transform=t)) - ax.axis("off") - ax.set_xlim(-0.1, 2.4) diff --git a/doc/users/next_whats_new/figure_label_rcparams.rst b/doc/users/next_whats_new/figure_label_rcparams.rst deleted file mode 100644 index 149da1e92cf0..000000000000 --- a/doc/users/next_whats_new/figure_label_rcparams.rst +++ /dev/null @@ -1,10 +0,0 @@ -Allow setting figure label size and weight globally and separately from title ------------------------------------------------------------------------------ - -The figure labels, ``Figure.supxlabel`` and ``Figure.supylabel``, size and -weight can be set separately from the figure title. Use :rc:`figure.labelsize` -and :rc:`figure.labelweight`. - -Note that if you have locally changed :rc:`figure.titlesize` or -:rc:`figure.titleweight`, you must now also change the introduced parameters -for a consistent result. diff --git a/doc/users/next_whats_new/fix_dash_offset_Patch.rst b/doc/users/next_whats_new/fix_dash_offset_Patch.rst deleted file mode 100644 index 7be55858f70f..000000000000 --- a/doc/users/next_whats_new/fix_dash_offset_Patch.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fix the dash offset of the Patch class --------------------------------------- -Traditionally, when setting the linestyle on a `.Patch` object using a dash tuple the -offset was ignored. Now the offset is passed to the draw method of Patch as expected -and it can be used as it is used with Line2D objects. diff --git a/doc/users/next_whats_new/font_fallback.rst b/doc/users/next_whats_new/font_fallback.rst deleted file mode 100644 index 51d9143147ce..000000000000 --- a/doc/users/next_whats_new/font_fallback.rst +++ /dev/null @@ -1,27 +0,0 @@ -Font fallback -------------- - -It is now possible to specify a list of fonts families and Matplotlib -will try them in order to locate a required glyph. - -.. plot:: - :caption: Demonstration of mixed English and Chinese text with font fallback. - :alt: The phrase "There are 几个汉字 in between!" rendered in various fonts. - :include-source: True - - import matplotlib.pyplot as plt - - text = "There are 几个汉字 in between!" - - plt.rcParams["font.size"] = 20 - fig = plt.figure(figsize=(4.75, 1.85)) - fig.text(0.05, 0.85, text, family=["WenQuanYi Zen Hei"]) - fig.text(0.05, 0.65, text, family=["Noto Sans CJK JP"]) - fig.text(0.05, 0.45, text, family=["DejaVu Sans", "Noto Sans CJK JP"]) - fig.text(0.05, 0.25, text, family=["DejaVu Sans", "WenQuanYi Zen Hei"]) - - plt.show() - - -This currently works with the Agg (and all of the GUI embeddings), svg, pdf, -ps, and inline backends. diff --git a/doc/users/next_whats_new/inset_axes_improvements.rst b/doc/users/next_whats_new/inset_axes_improvements.rst deleted file mode 100644 index ad4918120a84..000000000000 --- a/doc/users/next_whats_new/inset_axes_improvements.rst +++ /dev/null @@ -1,6 +0,0 @@ -Axes.inset_axes flexibility ---------------------------- - -`matplotlib.axes.Axes.inset_axes` now accepts the *projection*, *polar* and -*axes_class* keyword arguments, so that subclasses of `matplotlib.axes.Axes` may -be returned. diff --git a/doc/users/next_whats_new/layout_engine.rst b/doc/users/next_whats_new/layout_engine.rst deleted file mode 100644 index 9304ee9771e0..000000000000 --- a/doc/users/next_whats_new/layout_engine.rst +++ /dev/null @@ -1,7 +0,0 @@ -New ``layout_engine`` module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Matplotlib ships with ``tight_layout`` and ``constrained_layout`` layout -engines. A new ``layout_engine`` module is provided to allow downstream -libraries to write their own layout engines and `~.figure.Figure` objects can -now take a `.LayoutEngine` subclass as an argument to the *layout* parameter. diff --git a/doc/users/next_whats_new/legend_align.rst b/doc/users/next_whats_new/legend_align.rst deleted file mode 100644 index 4a1d479c8e27..000000000000 --- a/doc/users/next_whats_new/legend_align.rst +++ /dev/null @@ -1,6 +0,0 @@ -Legend can control alignment of title and handles -------------------------------------------------- - -`.Legend` now supports control the alignment of title and handles via the -keyword argument ``alignment``. You can also use `.Legend.set_alignment` -to control the alignment on existing Legends. diff --git a/doc/users/next_whats_new/list_font_names.rst b/doc/users/next_whats_new/list_font_names.rst deleted file mode 100644 index d3737cd8ba55..000000000000 --- a/doc/users/next_whats_new/list_font_names.rst +++ /dev/null @@ -1,10 +0,0 @@ -List of available font names ------------------------------- - -The list of available fonts are now easily accessible. Get a list of the -available font names in matplotlib with: - -.. code-block:: python - - from matplotlib import font_manager - font_manager.get_font_names() diff --git a/doc/users/next_whats_new/marker_none.rst b/doc/users/next_whats_new/marker_none.rst deleted file mode 100644 index b37f07ea1333..000000000000 --- a/doc/users/next_whats_new/marker_none.rst +++ /dev/null @@ -1,5 +0,0 @@ -``marker`` can now be set to the string "none" -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... to mean *no-marker*, consistently with other APIs which support the -lowercase version. Using "none" is recommended over using "None", to avoid -confusion with the None object. diff --git a/doc/users/next_whats_new/min_macos_version.rst b/doc/users/next_whats_new/min_macos_version.rst deleted file mode 100644 index 8d3a8f04fcdb..000000000000 --- a/doc/users/next_whats_new/min_macos_version.rst +++ /dev/null @@ -1,3 +0,0 @@ -New minimum macOS version -------------------------- -The macosx backend now requires macOS >= 10.12. diff --git a/doc/users/next_whats_new/modify_stairs_fill_edge_behaviour.rst b/doc/users/next_whats_new/modify_stairs_fill_edge_behaviour.rst deleted file mode 100644 index 1dc24a20907a..000000000000 --- a/doc/users/next_whats_new/modify_stairs_fill_edge_behaviour.rst +++ /dev/null @@ -1,9 +0,0 @@ -stairs(..., fill=True) to hide patch edge by setting lw=0 ---------------------------------------------------------- - -``stairs(..., fill=True)`` would previously hide Patch -edge by setting edgecolor="none". Calling ``set_color()`` -on the Patch after would make the Patch appear larger. -Updated treatment prevents this. Likewise calling -``stairs(..., fill=True, lw=3)`` will behave more -transparently. diff --git a/doc/users/next_whats_new/multicursor_multifigure.rst b/doc/users/next_whats_new/multicursor_multifigure.rst deleted file mode 100644 index 04b39f9d0c56..000000000000 --- a/doc/users/next_whats_new/multicursor_multifigure.rst +++ /dev/null @@ -1,8 +0,0 @@ -``MultiCursor`` now supports Axes split over multiple figures -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Previously, `.MultiCursor` only worked if all target Axes belonged to the same -figure. - -As a consequence of this change, the first argument to the `.MultiCursor` -constructor has become unused (it was previously the joint canvas of all Axes, -but the canvases are now directly inferred from the list of Axes). diff --git a/doc/users/next_whats_new/no_broken_streamlines.rst b/doc/users/next_whats_new/no_broken_streamlines.rst deleted file mode 100644 index 7160cd7caca0..000000000000 --- a/doc/users/next_whats_new/no_broken_streamlines.rst +++ /dev/null @@ -1,25 +0,0 @@ -Add option to plt.streamplot to not break streamlines ------------------------------------------------------ - -It is now possible to specify that streamplots have continuous, unbroken -streamlines. Previously streamlines would end to limit the number of lines -within a single grid cell. See the difference between the plots below: - -.. plot:: - - import matplotlib.pyplot as plt - import numpy as np - - w = 3 - Y, X = np.mgrid[-w:w:100j, -w:w:100j] - U = -1 - X**2 + Y - V = 1 + X - Y**2 - speed = np.sqrt(U**2 + V**2) - - fig, (ax0, ax1) = plt.subplots(1, 2, sharex=True) - - ax0.streamplot(X, Y, U, V, broken_streamlines=True) - ax0.set_title('broken_streamlines=True') - - ax1.streamplot(X, Y, U, V, broken_streamlines=False) - ax1.set_title('broken_streamlines=False') diff --git a/doc/users/next_whats_new/plt_xyticks_support_minor.rst b/doc/users/next_whats_new/plt_xyticks_support_minor.rst deleted file mode 100644 index fef2ce764113..000000000000 --- a/doc/users/next_whats_new/plt_xyticks_support_minor.rst +++ /dev/null @@ -1,15 +0,0 @@ -``plt.xticks`` and ``plt.yticks`` support *minor* keyword argument ------------------------------------------------------------------- - -It is now possible to set or get minor ticks using `.pyplot.xticks` and -`.pyplot.yticks` by setting ``minor=True``. - -.. plot:: - :include-source: true - - import matplotlib.pyplot as plt - plt.figure() - plt.plot([1, 2, 3, 3.5], [2, 1, 0, -0.5]) - plt.xticks([1, 2, 3], ["One", "Zwei", "Trois"]) - plt.xticks([1.414, 2.5, 3.142], - [r"$\sqrt{2}$", r"$\frac{5}{2}$", r"$\pi$"], minor=True) diff --git a/doc/users/next_whats_new/polygon_selector_box.rst b/doc/users/next_whats_new/polygon_selector_box.rst deleted file mode 100644 index 10116e6c75fb..000000000000 --- a/doc/users/next_whats_new/polygon_selector_box.rst +++ /dev/null @@ -1,6 +0,0 @@ -PolygonSelector bounding boxes ------------------------------- -`~matplotlib.widgets.PolygonSelector` now has a *draw_bounding_box* argument, which -when set to `True` will draw a bounding box around the polygon once it is -complete. The bounding box can be resized and moved, allowing the points of -the polygon to be easily resized. diff --git a/doc/users/next_whats_new/polygon_vert_setter.rst b/doc/users/next_whats_new/polygon_vert_setter.rst deleted file mode 100644 index 37dc442e79ea..000000000000 --- a/doc/users/next_whats_new/polygon_vert_setter.rst +++ /dev/null @@ -1,6 +0,0 @@ -Setting PolygonSelector vertices --------------------------------- -The vertices of `~matplotlib.widgets.PolygonSelector` can now be set -programmatically by using the `~matplotlib.widgets.PolygonSelector.verts` -property. Setting the vertices this way will reset the selector, and create -a new complete selector with the supplied vertices. diff --git a/doc/users/next_whats_new/rectangle_patch_rotation.rst b/doc/users/next_whats_new/rectangle_patch_rotation.rst deleted file mode 100644 index ba3c1b336604..000000000000 --- a/doc/users/next_whats_new/rectangle_patch_rotation.rst +++ /dev/null @@ -1,5 +0,0 @@ -Rectangle patch rotation point ------------------------------- - -The rotation point of the `~matplotlib.patches.Rectangle` can now be set to 'xy', -'center' or a 2-tuple of numbers. diff --git a/doc/users/next_whats_new/rename_ncol_keyword_in_legend.rst b/doc/users/next_whats_new/rename_ncol_keyword_in_legend.rst deleted file mode 100644 index 54db966bf8a9..000000000000 --- a/doc/users/next_whats_new/rename_ncol_keyword_in_legend.rst +++ /dev/null @@ -1,7 +0,0 @@ -``ncol`` keyword argument to ``legend`` renamed to ``ncols`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``ncol`` keyword argument to `~.Axes.legend` for controlling the number of -columns is renamed to ``ncols`` for consistency with the ``ncols`` and -``nrows`` keywords of `~.Figure.subplots` and `~.GridSpec`. -``ncol`` is still supported though. diff --git a/doc/users/next_whats_new/resample_colormaps.rst b/doc/users/next_whats_new/resample_colormaps.rst deleted file mode 100644 index f2fbe4da4d83..000000000000 --- a/doc/users/next_whats_new/resample_colormaps.rst +++ /dev/null @@ -1,13 +0,0 @@ -Colormap method for creating a different lookup table size ----------------------------------------------------------- -The new method `.Colormap.resampled` creates a new `.Colormap` instance -with the specified lookup table size. This is a replacement for manipulating -the lookup table size via ``get_cmap``. - -Use:: - - get_cmap(name).resampled(N) - -instead of:: - - get_cmap(name, lut=N) diff --git a/doc/users/next_whats_new/selector_improvement.rst b/doc/users/next_whats_new/selector_improvement.rst deleted file mode 100644 index f19282335705..000000000000 --- a/doc/users/next_whats_new/selector_improvement.rst +++ /dev/null @@ -1,40 +0,0 @@ -Selectors improvement: rotation, aspect ratio correction and add/remove state ------------------------------------------------------------------------------ - -The `~matplotlib.widgets.RectangleSelector` and -`~matplotlib.widgets.EllipseSelector` can now be rotated interactively between --45° and 45°. The range limits are currently dictated by the implementation. -The rotation is enabled or disabled by striking the *r* key -('r' is the default key mapped to 'rotate' in *state_modifier_keys*) or by calling -``selector.add_state('rotate')``. - -The aspect ratio of the axes can now be taken into account when using the -"square" state. This is enabled by specifying ``use_data_coordinates='True'`` when -the selector is initialized. - -In addition to changing selector state interactively using the modifier keys -defined in *state_modifier_keys*, the selector state can now be changed -programmatically using the *add_state* and *remove_state* methods. - - -.. code-block:: python - - import matplotlib.pyplot as plt - from matplotlib.widgets import RectangleSelector - import numpy as np - - values = np.arange(0, 100) - - fig = plt.figure() - ax = fig.add_subplot() - ax.plot(values, values) - - selector = RectangleSelector(ax, print, interactive=True, - drag_from_anywhere=True, - use_data_coordinates=True) - selector.add_state('rotate') # alternatively press 'r' key - # rotate the selector interactively - - selector.remove_state('rotate') # alternatively press 'r' key - - selector.add_state('square') diff --git a/doc/users/next_whats_new/snap_selector.rst b/doc/users/next_whats_new/snap_selector.rst deleted file mode 100644 index 9ff0ccd87e0c..000000000000 --- a/doc/users/next_whats_new/snap_selector.rst +++ /dev/null @@ -1,4 +0,0 @@ -SpanSelector widget can now be snapped to specified values -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The SpanSelector widget can now be snapped to values specified by the *snap_values* -argument. diff --git a/doc/users/next_whats_new/striped_lines.rst b/doc/users/next_whats_new/striped_lines.rst deleted file mode 100644 index dff1205a5db1..000000000000 --- a/doc/users/next_whats_new/striped_lines.rst +++ /dev/null @@ -1,19 +0,0 @@ -Striped lines (experimental) ----------------------------- - -New *gapcolor* parameter enables the creation of striped lines. - -.. plot:: - :include-source: true - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(1., 3., 10) - y = x**3 - - fig, ax = plt.subplots() - ax.plot(x, y, linestyle='--', color='orange', gapcolor='blue', - linewidth=3, label='a striped line') - ax.legend() - plt.show() diff --git a/doc/users/next_whats_new/strnorm.rst b/doc/users/next_whats_new/strnorm.rst deleted file mode 100644 index 42be191f2d55..000000000000 --- a/doc/users/next_whats_new/strnorm.rst +++ /dev/null @@ -1,6 +0,0 @@ -Setting norms with strings -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Norms can now be set (e.g. on images) using the string name of the -corresponding scale, e.g. ``imshow(array, norm="log")``. Note that in that -case, it is permissible to also pass *vmin* and *vmax*, as a new Norm instance -will be created under the hood. diff --git a/doc/users/next_whats_new/url_active_areas_rotate.rst b/doc/users/next_whats_new/url_active_areas_rotate.rst deleted file mode 100644 index 6c6d29be86fa..000000000000 --- a/doc/users/next_whats_new/url_active_areas_rotate.rst +++ /dev/null @@ -1,5 +0,0 @@ -The active URL area rotates when link text is rotated -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When link text is rotated in a matplotlib figure, the active URL -area will now include the link area. Previously, the active area -remained in the original, non-rotated, position. diff --git a/doc/users/next_whats_new/use_contourpy.rst b/doc/users/next_whats_new/use_contourpy.rst deleted file mode 100644 index 31be55804d1a..000000000000 --- a/doc/users/next_whats_new/use_contourpy.rst +++ /dev/null @@ -1,27 +0,0 @@ -New external dependency ContourPy used for quad contour calculations --------------------------------------------------------------------- - -Previously Matplotlib shipped its own C++ code for calculating the contours of -quad grids. Now the external library -`ContourPy `_ is used instead. There -is a choice of four algorithms to use, controlled by the *algorithm* keyword -argument to the functions `~matplotlib.axes.Axes.contour` and -`~matplotlib.axes.Axes.contourf`. The default behaviour is to use -``algorithm='mpl2014'`` which is the same algorithm that Matplotlib has been -using since 2014. - -See the `ContourPy documentation `_ for -further details of the different algorithms. - -.. note:: - - Contour lines and polygons produced by ``algorithm='mpl2014'`` will be the - same as those produced before this change to within floating-point - tolerance. The exception is for duplicate points, i.e. contours containing - adjacent (x, y) points that are identical; previously the duplicate points - were removed, now they are kept. Contours affected by this will produce the - same visual output, but there will be a greater number of points in the - contours. - - The locations of contour labels obtained by using - `~matplotlib.axes.Axes.clabel` may also be different. diff --git a/doc/users/next_whats_new/width_height_ratios.rst b/doc/users/next_whats_new/width_height_ratios.rst deleted file mode 100644 index 017c34a55cc4..000000000000 --- a/doc/users/next_whats_new/width_height_ratios.rst +++ /dev/null @@ -1,7 +0,0 @@ -``subplots``, ``subplot_mosaic`` accept *height_ratios* and *width_ratios* arguments ------------------------------------------------------------------------------------- - -The relative width and height of columns and rows in `~.Figure.subplots` and -`~.Figure.subplot_mosaic` can be controlled by passing *height_ratios* and -*width_ratios* keyword arguments to the methods. Previously, this required -passing the ratios in *gridspec_kws* arguments. diff --git a/doc/users/next_whats_new/windows_arm64.rst b/doc/users/next_whats_new/windows_arm64.rst deleted file mode 100644 index b649872ff2e5..000000000000 --- a/doc/users/next_whats_new/windows_arm64.rst +++ /dev/null @@ -1,8 +0,0 @@ -Windows on Arm support ----------------------- - -Preliminary support for windows on arm64 target added. - -Matplotlib for windows/arm64 requires FreeType 2.11 or above. - -No binary wheels are available yet but can be built from source. diff --git a/doc/users/prev_whats_new/whats_new_3.6.0.rst b/doc/users/prev_whats_new/whats_new_3.6.0.rst new file mode 100644 index 000000000000..457d0fc5743e --- /dev/null +++ b/doc/users/prev_whats_new/whats_new_3.6.0.rst @@ -0,0 +1,564 @@ +============================== +What's new in Matplotlib 3.6.0 +============================== + +For a list of all of the issues and pull requests since the last revision, see +the :ref:`github-stats`. + +.. contents:: Table of Contents + :depth: 4 + +.. toctree:: + :maxdepth: 4 + +Figure and Axes creation / management +===================================== + +``subplots``, ``subplot_mosaic`` accept *height_ratios* and *width_ratios* arguments +------------------------------------------------------------------------------------ + +The relative width and height of columns and rows in `~.Figure.subplots` and +`~.Figure.subplot_mosaic` can be controlled by passing *height_ratios* and +*width_ratios* keyword arguments to the methods. Previously, this required +passing the ratios in *gridspec_kws* arguments. + +New ``layout_engine`` module +---------------------------- + +Matplotlib ships with ``tight_layout`` and ``constrained_layout`` layout +engines. A new `.layout_engine` module is provided to allow downstream +libraries to write their own layout engines and `~.figure.Figure` objects can +now take a `.LayoutEngine` subclass as an argument to the *layout* parameter. + +Plotting methods +================ + +Striped lines (experimental) +---------------------------- + +The new *gapcolor* parameter to `~.Axes.plot` enables the creation of striped +lines. + +.. plot:: + :include-source: true + + import matplotlib.pyplot as plt + import numpy as np + + x = np.linspace(1., 3., 10) + y = x**3 + + fig, ax = plt.subplots() + ax.plot(x, y, linestyle='--', color='orange', gapcolor='blue', + linewidth=3, label='a striped line') + ax.legend() + plt.show() + +Custom cap widths in box and whisker plots in ``bxp`` and ``boxplot`` +--------------------------------------------------------------------- + +The new *capwidths* parameter to `~.Axes.bxp` and `~.Axes.boxplot` allows +controlling the widths of the caps in box and whisker plots. + +.. plot:: + :include-source: true + + import matplotlib.pyplot as plt + import numpy as np + x = np.linspace(-7, 7, 140) + x = np.hstack([-25, x, 25]) + fig, ax = plt.subplots() + ax.boxplot([x, x], notch=True, capwidths=[0.01, 0.2]) + plt.show() + +Easier labelling of bars in bar plot +------------------------------------ + +The *label* argument of `~.Axes.bar` can now be passed a list of labels for the +bars. + +.. code-block:: python + + import matplotlib.pyplot as plt + + x = ["a", "b", "c"] + y = [10, 20, 15] + + fig, ax = plt.subplots() + bar_container = ax.barh(x, y, label=x) + [bar.get_label() for bar in bar_container] + +New external dependency ContourPy used for quad contour calculations +-------------------------------------------------------------------- + +Previously Matplotlib shipped its own C++ code for calculating the contours of +quad grids. Now the external library `ContourPy +`_ is used instead. There is a choice +of four algorithms to use, controlled by the *algorithm* keyword argument to +the functions `~.axes.Axes.contour` and `~.axes.Axes.contourf`. The default +behaviour is to use ``algorithm='mpl2014'`` which is the same algorithm that +Matplotlib has been using since 2014. + +See the `ContourPy documentation `_ for +further details of the different algorithms. + +.. note:: + + Contour lines and polygons produced by ``algorithm='mpl2014'`` will be the + same as those produced before this change to within floating-point + tolerance. The exception is for duplicate points, i.e. contours containing + adjacent (x, y) points that are identical; previously the duplicate points + were removed, now they are kept. Contours affected by this will produce the + same visual output, but there will be a greater number of points in the + contours. + + The locations of contour labels obtained by using `~.axes.Axes.clabel` may + also be different. + +``streamplot`` can disable streamline breaks +-------------------------------------------- + +It is now possible to specify that streamplots have continuous, unbroken +streamlines. Previously streamlines would end to limit the number of lines +within a single grid cell. See the difference between the plots below: + +.. plot:: + + import matplotlib.pyplot as plt + import numpy as np + + w = 3 + Y, X = np.mgrid[-w:w:100j, -w:w:100j] + U = -1 - X**2 + Y + V = 1 + X - Y**2 + speed = np.sqrt(U**2 + V**2) + + fig, (ax0, ax1) = plt.subplots(1, 2, sharex=True) + + ax0.streamplot(X, Y, U, V, broken_streamlines=True) + ax0.set_title('broken_streamlines=True') + + ax1.streamplot(X, Y, U, V, broken_streamlines=False) + ax1.set_title('broken_streamlines=False') + +New axis scale ``asinh`` (experimental) +--------------------------------------- + +The new ``asinh`` axis scale offers an alternative to ``symlog`` that smoothly +transitions between the quasi-linear and asymptotically logarithmic regions of +the scale. This is based on an arcsinh transformation that allows plotting both +positive and negative values that span many orders of magnitude. + +.. plot:: + + import matplotlib.pyplot as plt + import numpy as np + + fig, (ax0, ax1) = plt.subplots(1, 2, sharex=True) + x = np.linspace(-3, 6, 100) + + ax0.plot(x, x) + ax0.set_yscale('symlog') + ax0.grid() + ax0.set_title('symlog') + + ax1.plot(x, x) + ax1.set_yscale('asinh') + ax1.grid() + ax1.set_title(r'$sinh^{-1}$') + + for p in (-2, 2): + for ax in (ax0, ax1): + c = plt.Circle((p, p), radius=0.5, fill=False, + color='red', alpha=0.8, lw=3) + ax.add_patch(c) + +``stairs(..., fill=True)`` hides patch edge by setting linewidth +---------------------------------------------------------------- + +``stairs(..., fill=True)`` would previously hide Patch edges by setting +``edgecolor="none"``. Consequently, calling ``set_color()`` on the Patch later +would make the Patch appear larger. + +Now, by using ``linewidth=0``, this apparent size change is prevented. Likewise +calling ``stairs(..., fill=True, linewidth=3)`` will behave more transparently. + +Fix the dash offset of the Patch class +-------------------------------------- + +Formerly, when setting the line style on a `.Patch` object using a dash tuple, +the offset was ignored. Now the offset is applied to the Patch as expected and +it can be used as it is used with `.Line2D` objects. + +Rectangle patch rotation point +------------------------------ + +The rotation point of the `~matplotlib.patches.Rectangle` can now be set to +'xy', 'center' or a 2-tuple of numbers. + +Axes.inset_axes flexibility +--------------------------- + +`matplotlib.axes.Axes.inset_axes` now accepts the *projection*, *polar* and +*axes_class* keyword arguments, so that subclasses of `matplotlib.axes.Axes` +may be returned. + +Colors and colormaps +==================== + +Colormap method for creating a different lookup table size +---------------------------------------------------------- + +The new method `.Colormap.resampled` creates a new `.Colormap` instance +with the specified lookup table size. This is a replacement for manipulating +the lookup table size via ``get_cmap``. + +Use:: + + get_cmap(name).resampled(N) + +instead of:: + + get_cmap(name, lut=N) + +Setting norms with strings +-------------------------- + +Norms can now be set (e.g. on images) using the string name of the +corresponding scale, e.g. ``imshow(array, norm="log")``. Note that in that +case, it is permissible to also pass *vmin* and *vmax*, as a new Norm instance +will be created under the hood. + +Titles, ticks, and labels +========================= + +``plt.xticks`` and ``plt.yticks`` support *minor* keyword argument +------------------------------------------------------------------ + +It is now possible to set or get minor ticks using `.pyplot.xticks` and +`.pyplot.yticks` by setting ``minor=True``. + +.. plot:: + :include-source: true + + import matplotlib.pyplot as plt + plt.figure() + plt.plot([1, 2, 3, 3.5], [2, 1, 0, -0.5]) + plt.xticks([1, 2, 3], ["One", "Zwei", "Trois"]) + plt.xticks([1.414, 2.5, 3.142], + [r"$\sqrt{2}$", r"$\frac{5}{2}$", r"$\pi$"], minor=True) + +Legends +======= + +Legend can control alignment of title and handles +------------------------------------------------- + +`.Legend` now supports controlling the alignment of the title and handles via +the keyword argument *alignment*. You can also use `.Legend.set_alignment` to +control the alignment on existing Legends. + +*ncol* keyword argument to ``legend`` renamed to *ncols* +-------------------------------------------------------- + +The *ncol* keyword argument to `~.Axes.legend` for controlling the number of +columns is renamed to *ncols* for consistency with the *ncols* and *nrows* +keywords of `~.Figure.subplots` and `~.GridSpec`. *ncol* remains supported for +backwards compatibility, but is discouraged. + +Markers +======= + +``marker`` can now be set to the string "none" +---------------------------------------------- + +The string "none" means *no-marker*, consistent with other APIs which support +the lowercase version. Using "none" is recommended over using "None", to avoid +confusion with the None object. + +Customization of ``MarkerStyle`` join and cap style +--------------------------------------------------- + +New `.MarkerStyle` parameters allow control of join style and cap style, and +for the user to supply a transformation to be applied to the marker (e.g. a +rotation). + +.. plot:: + :include-source: true + + import matplotlib.pyplot as plt + from matplotlib.markers import MarkerStyle + from matplotlib.transforms import Affine2D + fig, ax = plt.subplots(figsize=(6, 1)) + fig.suptitle('New markers', fontsize=14) + for col, (size, rot) in enumerate(zip([2, 5, 10], [0, 45, 90])): + t = Affine2D().rotate_deg(rot).scale(size) + ax.plot(col, 0, marker=MarkerStyle("*", transform=t)) + ax.axis("off") + ax.set_xlim(-0.1, 2.4) + +Fonts and Text +============== + +Font fallback +------------- + +It is now possible to specify a list of fonts families and Matplotlib will try +them in order to locate a required glyph. + +.. plot:: + :caption: Demonstration of mixed English and Chinese text with font fallback. + :alt: The phrase "There are 几个汉字 in between!" rendered in various fonts. + :include-source: True + + import matplotlib.pyplot as plt + + text = "There are 几个汉字 in between!" + + plt.rcParams["font.size"] = 20 + fig = plt.figure(figsize=(4.75, 1.85)) + fig.text(0.05, 0.85, text, family=["WenQuanYi Zen Hei"]) + fig.text(0.05, 0.65, text, family=["Noto Sans CJK JP"]) + fig.text(0.05, 0.45, text, family=["DejaVu Sans", "Noto Sans CJK JP"]) + fig.text(0.05, 0.25, text, family=["DejaVu Sans", "WenQuanYi Zen Hei"]) + + plt.show() + +This currently works with the Agg (and all of the GUI embeddings), svg, pdf, +ps, and inline backends. + +List of available font names +---------------------------- + +The list of available fonts are now easily accessible. To get a list of the +available font names in Matplotlib use: + +.. code-block:: python + + from matplotlib import font_manager + font_manager.get_font_names() + +``math_to_image`` now has a *color* keyword argument +---------------------------------------------------- + +To easily support external libraries that rely on the MathText rendering of +Matplotlib to generate equation images, a *color* keyword argument was added to +`~matplotlib.mathtext.math_to_image`. + +.. code-block:: python + + from matplotlib import mathtext + mathtext.math_to_image('$x^2$', 'filename.png', color='Maroon') + +Active URL area rotates with link text +-------------------------------------- + +When link text is rotated in a figure, the active URL area will now include the +link area. Previously, the active area remained in the original, non-rotated, +position. + +rcParams improvements +===================== + +Allow setting figure label size and weight globally and separately from title +----------------------------------------------------------------------------- + +For figure labels, ``Figure.supxlabel`` and ``Figure.supylabel``, the size and +weight can be set separately from the figure title using :rc:`figure.labelsize` +and :rc:`figure.labelweight`. + +Note that if you have changed :rc:`figure.titlesize` or +:rc:`figure.titleweight`, you must now also change the introduced parameters +for a consistent result with past behaviour. + +Double-quoted strings in matplotlibrc +------------------------------------- + +You can now use double-quotes around strings. This allows using the '#' +character in strings. Without quotes, '#' is interpreted as start of a comment. +In particular, you can now define hex-colors: + +.. code-block:: none + + grid.color: "#b0b0b0" + +3D Axes improvements +==================== + +Custom focal length for 3D camera +--------------------------------- + +The 3D Axes can now better mimic real-world cameras by specifying the focal +length of the virtual camera. The default focal length of 1 corresponds to a +Field of View (FOV) of 90°, and is backwards-compatible with existing 3D plots. +An increased focal length between 1 and infinity "flattens" the image, while a +decreased focal length between 1 and 0 exaggerates the perspective and gives +the image more apparent depth. + +The focal length can be calculated from a desired FOV via the equation: + +.. mathmpl:: + + focal\_length = 1/\tan(FOV/2) + +.. plot:: + :include-source: true + + from mpl_toolkits.mplot3d import axes3d + import matplotlib.pyplot as plt + from numpy import inf + fig, axs = plt.subplots(1, 3, subplot_kw={'projection': '3d'}) + X, Y, Z = axes3d.get_test_data(0.05) + focal_lengths = [0.2, 1, inf] + for ax, fl in zip(axs, focal_lengths): + ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) + ax.set_proj_type('persp', focal_length=fl) + ax.set_title(f"focal_length = {fl}") + fig.set_size_inches(10, 4) + plt.show() + +3D plots gained a 3rd "roll" viewing angle +------------------------------------------ + +3D plots can now be viewed from any orientation with the addition of a 3rd roll +angle, which rotates the plot about the viewing axis. Interactive rotation +using the mouse still only controls elevation and azimuth, meaning that this +feature is relevant to users who create more complex camera angles +programmatically. The default roll angle of 0 is backwards-compatible with +existing 3D plots. + +.. plot:: + :include-source: true + + from mpl_toolkits.mplot3d import axes3d + import matplotlib.pyplot as plt + fig = plt.figure() + ax = fig.add_subplot(projection='3d') + X, Y, Z = axes3d.get_test_data(0.05) + ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) + ax.view_init(elev=0, azim=0, roll=30) + ax.set_title('elev=0, azim=0, roll=30') + plt.show() + +Equal aspect ratio for 3D plots +------------------------------- + +Users can set the aspect ratio for the X, Y, Z axes of a 3D plot to be 'equal', +'equalxy', 'equalxz', or 'equalyz' rather than the default of 'auto'. + +.. plot:: + :include-source: true + + import matplotlib.pyplot as plt + import numpy as np + from itertools import combinations, product + + aspects = ('auto', 'equal', 'equalxy', 'equalyz', 'equalxz') + fig, axs = plt.subplots(1, len(aspects), subplot_kw={'projection': '3d'}) + + # Draw rectangular cuboid with side lengths [1, 1, 5] + r = [0, 1] + scale = np.array([1, 1, 5]) + pts = combinations(np.array(list(product(r, r, r))), 2) + for start, end in pts: + if np.sum(np.abs(start - end)) == r[1] - r[0]: + for ax in axs: + ax.plot3D(*zip(start*scale, end*scale), color='C0') + + # Set the aspect ratios + for i, ax in enumerate(axs): + ax.set_box_aspect((3, 4, 5)) + ax.set_aspect(aspects[i]) + ax.set_title(f"set_aspect('{aspects[i]}')") + + fig.set_size_inches(13, 3) + plt.show() + +Interactive tool improvements +============================= + +Rotation, aspect ratio correction and add/remove state +------------------------------------------------------ + +The `.RectangleSelector` and `.EllipseSelector` can now be rotated +interactively between -45° and 45°. The range limits are currently dictated by +the implementation. The rotation is enabled or disabled by striking the *r* key +('r' is the default key mapped to 'rotate' in *state_modifier_keys*) or by +calling ``selector.add_state('rotate')``. + +The aspect ratio of the axes can now be taken into account when using the +"square" state. This is enabled by specifying ``use_data_coordinates='True'`` +when the selector is initialized. + +In addition to changing selector state interactively using the modifier keys +defined in *state_modifier_keys*, the selector state can now be changed +programmatically using the *add_state* and *remove_state* methods. + +.. code-block:: python + + import matplotlib.pyplot as plt + from matplotlib.widgets import RectangleSelector + import numpy as np + + values = np.arange(0, 100) + + fig = plt.figure() + ax = fig.add_subplot() + ax.plot(values, values) + + selector = RectangleSelector(ax, print, interactive=True, + drag_from_anywhere=True, + use_data_coordinates=True) + selector.add_state('rotate') # alternatively press 'r' key + # rotate the selector interactively + + selector.remove_state('rotate') # alternatively press 'r' key + + selector.add_state('square') + +``MultiCursor`` now supports Axes split over multiple figures +------------------------------------------------------------- + +Previously, `.MultiCursor` only worked if all target Axes belonged to the same +figure. + +As a consequence of this change, the first argument to the `.MultiCursor` +constructor has become unused (it was previously the joint canvas of all Axes, +but the canvases are now directly inferred from the list of Axes). + +``PolygonSelector`` bounding boxes +---------------------------------- + +`.PolygonSelector` now has a *draw_bounding_box* argument, which when set to +`True` will draw a bounding box around the polygon once it is complete. The +bounding box can be resized and moved, allowing the points of the polygon to be +easily resized. + +Setting ``PolygonSelector`` vertices +------------------------------------ + +The vertices of `.PolygonSelector` can now be set programmatically by using the +`.PolygonSelector.verts` property. Setting the vertices this way will reset the +selector, and create a new complete selector with the supplied vertices. + +``SpanSelector`` widget can now be snapped to specified values +-------------------------------------------------------------- + +The `.SpanSelector` widget can now be snapped to values specified by the +*snap_values* argument. + +Platform-specific changes +========================= + +New minimum macOS version +------------------------- + +The macosx backend now requires macOS >= 10.12. + +Windows on ARM support +---------------------- + +Preliminary support for Windows on arm64 target has been added. This support +requires FreeType 2.11 or above. + +No binary wheels are available yet but it may be built from source. diff --git a/doc/users/release_notes.rst b/doc/users/release_notes.rst index f0fbd5a32de0..40c286e06a84 100644 --- a/doc/users/release_notes.rst +++ b/doc/users/release_notes.rst @@ -7,13 +7,14 @@ Release notes ============= .. include from another document so that it's easy to exclude this for releases -.. include:: release_notes_next.rst +.. include: release_notes_next.rst Version 3.6 =========== .. toctree:: :maxdepth: 1 + prev_whats_new/whats_new_3.6.0.rst ../api/prev_api_changes/api_changes_3.6.0.rst github_stats.rst @@ -27,7 +28,7 @@ Version 3.5 ../api/prev_api_changes/api_changes_3.5.3.rst ../api/prev_api_changes/api_changes_3.5.2.rst ../api/prev_api_changes/api_changes_3.5.0.rst - github_stats.rst + prev_whats_new/github_stats_3.5.3.rst prev_whats_new/github_stats_3.5.2.rst prev_whats_new/github_stats_3.5.1.rst prev_whats_new/github_stats_3.5.0.rst