Overview

Matplotlib 3.6, released on November 17, 2022, improves default styles and adds new customization options.

Main Features

Improved styles

Default styles are modernized with better color palettes and more readable fonts.

python
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('seaborn-v0_8')

x = np.linspace(0, 10, 100)
plt.plot(x, np.sin(x), label='sin')
plt.plot(x, np.cos(x), label='cos')
plt.legend()
plt.title('Trigonometric functions')
# plt.show()

Improved figure and axes

Subplot management is simplified with subplot_mosaic and better layout options.

python
import matplotlib.pyplot as plt
import numpy as np

fig, axs = plt.subplot_mosaic(
    [['A', 'B'], ['C', 'C']],
    figsize=(8, 6),
)
axs['A'].plot([1, 2, 3])
axs['B'].bar([1, 2, 3], [4, 5, 6])
axs['C'].scatter(np.random.randn(50), np.random.randn(50))
# plt.show()

Sources