https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.7.0.html Skip to main content [ ] [ ] [ ] Ctrl+K Logo image Logo image * Plot types * Examples * Tutorials * Reference * User guide * Develop * Releases stable * Gitter * Discourse * GitHub * Twitter * Plot types * Examples * Tutorials * Reference * User guide * Develop * Releases stable * Gitter * Discourse * GitHub * Twitter Section Navigation * What's new in Matplotlib 3.7.0 (Feb 13, 2023)[*] * API Changes for 3.7.0 * GitHub statistics (Feb 13, 2023)[ ] + GitHub statistics for 3.6.3 (Jan 11, 2023) + GitHub statistics for 3.6.2 (Nov 02, 2022) + GitHub statistics for 3.6.1 (Oct 08, 2022) + GitHub statistics for 3.6.0 (Sep 15, 2022) + GitHub statistics for 3.5.3 (Aug 10, 2022) + GitHub statistics for 3.5.2 (May 02, 2022) + GitHub statistics for 3.5.1 (Dec 11, 2021) + GitHub statistics for 3.5.0 (Nov 15, 2021) + GitHub statistics for 3.4.3 (August 21, 2021) + GitHub statistics for 3.4.2 (May 08, 2021) + GitHub statistics for 3.4.1 (Mar 31, 2021) + GitHub statistics for 3.4.0 (Mar 26, 2021) + GitHub statistics for 3.3.4 (Jan 28, 2021) + GitHub statistics for 3.3.3 (Nov 11, 2020) + GitHub statistics for 3.3.2 (Sep 15, 2020) + GitHub statistics for 3.3.1 (Aug 13, 2020) + GitHub statistics for 3.3.0 (Jul 16, 2020) + GitHub statistics for 3.2.2 (Jun 17, 2020) + GitHub statistics for 3.2.1 (Mar 18, 2020) + GitHub statistics for 3.2.0 (Mar 04, 2020) + GitHub statistics for 3.1.3 (Feb 03, 2020) + GitHub statistics for 3.1.2 (Nov 21, 2019) + GitHub statistics for 3.1.1 (Jul 02, 2019) + GitHub statistics for 3.1.0 (May 18, 2019) + GitHub statistics for 3.0.3 (Feb 28, 2019) + GitHub statistics for 3.0.2 (Nov 10, 2018) + GitHub statistics for 3.0.1 (Oct 25, 2018) + GitHub statistics for 3.0.0 (Sep 18, 2018) * What's new in Matplotlib 3.6.0 (Sep 15, 2022)[ ] * API Changes for 3.6.1 * API Changes for 3.6.0 * GitHub statistics for 3.6.3 (Jan 11, 2023) * GitHub statistics for 3.6.2 (Nov 02, 2022) * GitHub statistics for 3.6.1 (Oct 08, 2022) * GitHub statistics for 3.6.0 (Sep 15, 2022) * What's new in Matplotlib 3.5.2 (May 02, 2022)[ ] * What's new in Matplotlib 3.5.0 (Nov 15, 2021)[ ] * API Changes for 3.5.3 * API Changes for 3.5.2 * API Changes for 3.5.0 * GitHub statistics for 3.5.3 (Aug 10, 2022) * GitHub statistics for 3.5.2 (May 02, 2022) * GitHub statistics for 3.5.1 (Dec 11, 2021) * GitHub statistics for 3.5.0 (Nov 15, 2021) * What's new in Matplotlib 3.4.0 (Mar 26, 2021)[ ] * API Changes for 3.4.2 * API Changes for 3.4.0 * GitHub statistics for 3.4.1 (Mar 31, 2021) * GitHub statistics for 3.4.0 (Mar 26, 2021) * What's new in Matplotlib 3.3.0 (Jul 16, 2020)[ ] * API Changes for 3.3.1 * API Changes for 3.3.0 * GitHub statistics for 3.3.4 (Jan 28, 2021) * GitHub statistics for 3.3.3 (Nov 11, 2020) * GitHub statistics for 3.3.2 (Sep 15, 2020) * GitHub statistics for 3.3.1 (Aug 13, 2020) * GitHub statistics for 3.3.0 (Jul 16, 2020) * What's new in Matplotlib 3.2 (Mar 04, 2020)[ ] * API Changes for 3.2.0 * GitHub statistics for 3.2.2 (Jun 17, 2020) * GitHub statistics for 3.2.1 (Mar 18, 2020) * GitHub statistics for 3.2.0 (Mar 04, 2020) * What's new in Matplotlib 3.1 (May 18, 2019)[ ] * API Changes for 3.1.1 * API Changes for 3.1.0 * GitHub statistics for 3.1.3 (Feb 03, 2020) * GitHub statistics for 3.1.2 (Nov 21, 2019) * GitHub statistics for 3.1.1 (Jul 02, 2019) * GitHub statistics for 3.1.0 (May 18, 2019) * What's new in Matplotlib 3.0 (Sep 18, 2018) * API Changes for 3.0.1 * API Changes for 3.0.0 * GitHub statistics for 3.0.3 (Feb 28, 2019) * GitHub statistics for 3.0.2 (Nov 10, 2018) * GitHub statistics for 3.0.1 (Oct 25, 2018) * GitHub statistics for 3.0.0 (Sep 18, 2018) * What's new in Matplotlib 2.2 (Mar 06, 2018) * API Changes in 2.2.0 * What's new in Matplotlib 2.1.0 (Oct 7, 2017) * API Changes in 2.1.2 * API Changes in 2.1.1 * API Changes in 2.1.0 * What's new in Matplotlib 2.0 (Jan 17, 2017)[ ] + Changes to the default style * API Changes in 2.0.1 * API Changes in 2.0.0 * What's new in Matplotlib 1.5 (Oct 29, 2015) * API Changes in 1.5.3 * API Changes in 1.5.2 * API Changes in 1.5.0 * What's new in Matplotlib 1.4 (Aug 25, 2014) * API Changes in 1.4.x * What's new in Matplotlib 1.3 (Aug 01, 2013) * API Changes in 1.3.x * What's new in Matplotlib 1.2.2 * What's new in Matplotlib 1.2 (Nov 9, 2012) * API Changes in 1.2.x * What's new in Matplotlib 1.1 (Nov 02, 2011) * API Changes in 1.1.x * What's new in Matplotlib 1.0 (Jul 06, 2010) * List of changes to Matplotlib prior to 2015 * What's new in Matplotlib 0.99 (Aug 29, 2009) * Changes beyond 0.99.x * Changes in 0.99 * What's new in Matplotlib 0.98.4 * Changes for 0.98.x * Changes for 0.98.1 * Changes for 0.98.0 * Changes for 0.91.2 * Changes for 0.91.0 * Changes for 0.90.1 * Changes for 0.90.0 * Changes for 0.87.7 * Changes for 0.86 * Changes for 0.85 * Changes for 0.84 * Changes for 0.83 * Changes for 0.82 * Changes for 0.81 * Changes for 0.80 * Changes for 0.73 * Changes for 0.72 * Changes for 0.71 * Changes for 0.70 * Changes for 0.65.1 * Changes for 0.65 * Changes for 0.63 * Changes for 0.61 * Changes for 0.60 * Changes for 0.54.3 * Changes for 0.54 * Changes for 0.50 * Changes for 0.42 * Changes for 0.40 What's new in Matplotlib 3.7.0 (Feb 13, 2023)# For a list of all of the issues and pull requests since the last revision, see the GitHub statistics (Feb 13, 2023). Table of Contents * What's new in Matplotlib 3.7.0 (Feb 13, 2023) + Plotting and Annotation improvements o hatch parameter for pie o Polar plot errors drawn in polar coordinates o Additional format string options in bar_label o ellipse boxstyle option for annotations o The extent of imshow can now be expressed with units o Reversed order of legend entries o pcolormesh accepts RGB(A) colors o View current appearance settings for ticks, tick labels, and gridlines o Style files can be imported from third-party packages + Improvements to 3D Plotting o 3D plot pan and zoom buttons o adjustable keyword argument for setting equal aspect ratios in 3D o Poly3DCollection supports shading o rcParam for 3D pane color + Figure and Axes Layout o colorbar now has a location keyword argument o Figure legends can be placed outside figures using constrained_layout o Per-subplot keyword arguments in subplot_mosaic o subplot_mosaic no longer provisional + Widget Improvements o Custom styling of button widgets o Blitting in Button widgets + Other Improvements o Source links can be shown or hidden for each Sphinx plot directive o Figure hooks + New & Improved Narrative Documentation Plotting and Annotation improvements# hatch parameter for pie# pie now accepts a hatch keyword that takes as input a hatch or list of hatches: fig, (ax1, ax2) = plt.subplots(ncols=2) x = [10, 30, 60] ax1.pie(x, hatch=['.', 'o', 'O']) ax2.pie(x, hatch='.O') ax1.set_title("hatch=['.', 'o', 'O']") ax2.set_title("hatch='.O'") (Source code, png) Two pie charts, identified as ax1 and ax2, both have a small blue slice, a medium orange slice, and a large green slice. ax1 has a dot hatching on the small slice, a small open circle hatching on the medium slice, and a large open circle hatching on the large slice. ax2 has the same large open circle with a dot hatch on every slice. Polar plot errors drawn in polar coordinates# Caps and error lines are now drawn with respect to polar coordinates, when plotting errorbars on polar plots. ../../_images/sphx_glr_polar_error_caps_001.png Additional format string options in bar_label# The fmt argument of bar_label now accepts {}-style format strings: import matplotlib.pyplot as plt fruit_names = ['Coffee', 'Salted Caramel', 'Pistachio'] fruit_counts = [4000, 2000, 7000] fig, ax = plt.subplots() bar_container = ax.bar(fruit_names, fruit_counts) ax.set(ylabel='pints sold', title='Gelato sales by flavor', ylim=(0, 8000)) ax.bar_label(bar_container, fmt='{:,.0f}') (Source code, png) ../../_images/whats_new_3-7-0-2.png It also accepts callables: animal_names = ['Lion', 'Gazelle', 'Cheetah'] mph_speed = [50, 60, 75] fig, ax = plt.subplots() bar_container = ax.bar(animal_names, mph_speed) ax.set(ylabel='speed in MPH', title='Running speeds', ylim=(0, 80)) ax.bar_label( bar_container, fmt=lambda x: '{:.1f} km/h'.format(x * 1.61) ) (Source code, png) ../../_images/whats_new_3-7-0-3.png ellipse boxstyle option for annotations# The 'ellipse' option for boxstyle can now be used to create annotations with an elliptical outline. It can be used as a closed curve shape for longer texts instead of the 'circle' boxstyle which can get quite big. import matplotlib.pyplot as plt fig, ax = plt.subplots(figsize=(5, 5)) t = ax.text(0.5, 0.5, "elliptical box", ha="center", size=15, bbox=dict(boxstyle="ellipse,pad=0.3")) (Source code, png) ../../_images/whats_new_3-7-0-4.png The extent of imshow can now be expressed with units# The extent parameter of imshow and set_extent can now be expressed with units. import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(layout='constrained') date_first = np.datetime64('2020-01-01', 'D') date_last = np.datetime64('2020-01-11', 'D') arr = [[i+j for i in range(10)] for j in range(10)] ax.imshow(arr, origin='lower', extent=[0, 10, date_first, date_last]) plt.show() (Source code, png) ../../_images/whats_new_3-7-0-5.png Reversed order of legend entries# The order of legend entries can now be reversed by passing reverse= True to legend. pcolormesh accepts RGB(A) colors# The pcolormesh method can now handle explicit colors specified with RGB(A) values. To specify colors, the array must be 3D with a shape of (M, N, [3, 4]). import matplotlib.pyplot as plt import numpy as np colors = np.linspace(0, 1, 90).reshape((5, 6, 3)) plt.pcolormesh(colors) plt.show() (Source code, png) ../../_images/whats_new_3-7-0-6.png View current appearance settings for ticks, tick labels, and gridlines# The new get_tick_params method can be used to retrieve the appearance settings that will be applied to any additional ticks, tick labels, and gridlines added to the plot: >>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots() >>> ax.yaxis.set_tick_params(labelsize=30, labelcolor='red', ... direction='out', which='major') >>> ax.yaxis.get_tick_params(which='major') {'direction': 'out', 'left': True, 'right': False, 'labelleft': True, 'labelright': False, 'gridOn': False, 'labelsize': 30, 'labelcolor': 'red'} >>> ax.yaxis.get_tick_params(which='minor') {'left': True, 'right': False, 'labelleft': True, 'labelright': False, 'gridOn': False} Style files can be imported from third-party packages# Third-party packages can now distribute style files that are globally available as follows. Assume that a package is importable as import mypackage, with a mypackage/__init__.py module. Then a mypackage/ presentation.mplstyle style sheet can be used as plt.style.use ("mypackage.presentation"). The implementation does not actually import mypackage, making this process safe against possible import-time side effects. Subpackages (e.g. dotted.package.name) are also supported. Improvements to 3D Plotting# 3D plot pan and zoom buttons# The pan and zoom buttons in the toolbar of 3D plots are now enabled. Unselect both to rotate the plot. When the zoom button is pressed, zoom in by using the left mouse button to draw a bounding box, and out by using the right mouse button to draw the box. When zooming a 3D plot, the current view aspect ratios are kept fixed. adjustable keyword argument for setting equal aspect ratios in 3D# While setting equal aspect ratios for 3D plots, users can choose to modify either the data limits or the bounding box in parity with 2D Axes. 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'}, figsize=(12, 6)) # Draw rectangular cuboid with side lengths [4, 3, 5] r = [0, 1] scale = np.array([4, 3, 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_aspect(aspects[i], adjustable='datalim') # Alternatively: ax.set_aspect(aspects[i], adjustable='box') # which will change the box aspect ratio instead of axis data limits. ax.set_title(f"set_aspect('{aspects[i]}')") plt.show() (Source code, png) ../../_images/whats_new_3-7-0-7.png Poly3DCollection supports shading# It is now possible to shade a Poly3DCollection. This is useful if the polygons are obtained from e.g. a 3D model. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.art3d import Poly3DCollection # Define 3D shape block = np.array([ [[1, 1, 0], [1, 0, 0], [0, 1, 0]], [[1, 1, 0], [1, 1, 1], [1, 0, 0]], [[1, 1, 0], [1, 1, 1], [0, 1, 0]], [[1, 0, 0], [1, 1, 1], [0, 1, 0]] ]) ax = plt.subplot(projection='3d') pc = Poly3DCollection(block, facecolors='b', shade=True) ax.add_collection(pc) plt.show() (Source code, png) ../../_images/whats_new_3-7-0-8.png rcParam for 3D pane color# The rcParams rcParams["axes3d.xaxis.panecolor"] (default: (0.95, 0.95, 0.95, 0.5)), rcParams["axes3d.yaxis.panecolor"] (default: (0.9, 0.9, 0.9, 0.5)), rcParams["axes3d.zaxis.panecolor"] (default: (0.925, 0.925, 0.925, 0.5)) can be used to change the color of the background panes in 3D plots. Note that it is often beneficial to give them slightly different shades to obtain a "3D effect" and to make them slightly transparent (alpha < 1). import matplotlib.pyplot as plt with plt.rc_context({'axes3d.xaxis.panecolor': (0.9, 0.0, 0.0, 0.5), 'axes3d.yaxis.panecolor': (0.7, 0.0, 0.0, 0.5), 'axes3d.zaxis.panecolor': (0.8, 0.0, 0.0, 0.5)}): fig = plt.figure() fig.add_subplot(projection='3d') (Source code, png) ../../_images/whats_new_3-7-0-9.png Figure and Axes Layout# colorbar now has a location keyword argument# The colorbar method now supports a location keyword argument to more easily position the color bar. This is useful when providing your own inset axes using the cax keyword argument and behaves similar to the case where axes are not provided (where the location keyword is passed through). orientation and ticklocation are no longer required as they are determined by location. ticklocation can still be provided if the automatic setting is not preferred. (orientation can also be provided but must be compatible with the location.) An example is: import matplotlib.pyplot as plt import numpy as np rng = np.random.default_rng(19680801) imdata = rng.random((10, 10)) fig, ax = plt.subplots(layout='constrained') im = ax.imshow(imdata) fig.colorbar(im, cax=ax.inset_axes([0, 1.05, 1, 0.05]), location='top') (Source code, png) ../../_images/whats_new_3-7-0-10.png Figure legends can be placed outside figures using constrained_layout # Constrained layout will make space for Figure legends if they are specified by a loc keyword argument that starts with the string "outside". The codes are unique from axes codes, in that "outside upper right" will make room at the top of the figure for the legend, whereas "outside right upper" will make room on the right-hand side of the figure. See Legend guide for details. Per-subplot keyword arguments in subplot_mosaic# It is now possible to pass keyword arguments through to Axes creation in each specific call to add_subplot in Figure.subplot_mosaic and pyplot.subplot_mosaic : fig, axd = plt.subplot_mosaic( "AB;CD", per_subplot_kw={ "A": {"projection": "polar"}, ("C", "D"): {"xscale": "log"}, "B": {"projection": "3d"}, }, ) (Source code, png) ../../_images/whats_new_3-7-0-11.png This is particularly useful for creating mosaics with mixed projections, but any keyword arguments can be passed through. subplot_mosaic no longer provisional# The API on Figure.subplot_mosaic and pyplot.subplot_mosaic are now considered stable and will change under Matplotlib's normal deprecation process. Widget Improvements# Custom styling of button widgets# Additional custom styling of button widgets may be achieved via the label_props and radio_props arguments to RadioButtons; and the label_props, frame_props, and check_props arguments to CheckButtons. (Source code, png) ../../_images/whats_new_3-7-0-12.png Blitting in Button widgets# The Button, CheckButtons, and RadioButtons widgets now support blitting for faster rendering, on backends that support it, by passing useblit=True to the constructor. Blitting is enabled by default on supported backends. Other Improvements# Source links can be shown or hidden for each Sphinx plot directive# The Sphinx plot directive (.. plot::) now supports a :show-source-link: option to show or hide the link to the source code for each plot. The default is set using the plot_html_show_source_link variable in conf.py (which defaults to True). Figure hooks# The new rcParams["figure.hooks"] (default: []) provides a mechanism to register arbitrary customizations on pyplot figures; it is a list of "dotted.module.name:dotted.callable.name" strings specifying functions that are called on each figure created by pyplot.figure; these functions can e.g. attach callbacks or modify the toolbar. See mplcvd -- an example of figure hook for an example of toolbar customization. New & Improved Narrative Documentation# * Brand new Animations tutorial. * New grouped and stacked bar chart examples. * New section for new contributors and reorganized git instructions in the contributing guide. * Restructured Annotations tutorial. On this page * Plotting and Annotation improvements + hatch parameter for pie + Polar plot errors drawn in polar coordinates + Additional format string options in bar_label + ellipse boxstyle option for annotations + The extent of imshow can now be expressed with units + Reversed order of legend entries + pcolormesh accepts RGB(A) colors + View current appearance settings for ticks, tick labels, and gridlines + Style files can be imported from third-party packages * Improvements to 3D Plotting + 3D plot pan and zoom buttons + adjustable keyword argument for setting equal aspect ratios in 3D + Poly3DCollection supports shading + rcParam for 3D pane color * Figure and Axes Layout + colorbar now has a location keyword argument + Figure legends can be placed outside figures using constrained_layout + Per-subplot keyword arguments in subplot_mosaic + subplot_mosaic no longer provisional * Widget Improvements + Custom styling of button widgets + Blitting in Button widgets * Other Improvements + Source links can be shown or hidden for each Sphinx plot directive + Figure hooks * New & Improved Narrative Documentation (c) Copyright 2002-2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012-2023 The Matplotlib development team. Created using Sphinx 5.3.0. Built from v3.7.0-3-g235131a6bc.