Overview

Matplotlib 3.7, released on June 14, 2023, introduces shortened aliases for common properties and improves default styles.

Main Features

Shortened aliases

Frequently used properties now have shorter aliases: lw for linewidth, ls for linestyle, etc.

python
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

fig, ax = plt.subplots()
# Shortened aliases
ax.plot(x, np.sin(x), lw=2, ls='--', c='red', label='sin')
ax.plot(x, np.cos(x), lw=2, ls='-', c='blue', label='cos')
ax.set(xlabel='x', ylabel='y', title='Functions')
ax.legend()
# plt.show()

Improved default styles

Default styles are more modern with better colors, fonts, and margins. The seaborn-v0_8 theme is included.

python
import matplotlib.pyplot as plt
import numpy as np

# Using a predefined style
plt.style.use('seaborn-v0_8-whitegrid')

data = np.random.randn(1000)
fig, axes = plt.subplots(1, 2, figsize=(10, 4))
axes[0].hist(data, bins=30, edgecolor='white')
axes[0].set_title('Histogram')
axes[1].boxplot(data)
axes[1].set_title('Box plot')
# plt.show()

Sources