How to combine two Affine2D transformations in matplotlib

If you have two Affine2D transformations, you can combine them by using the + operator. Internally, this will multiply the two transformation matrices, which is equivalent to applying the two transformations in sequence:

# Example: Combine transform1 with transform2
combined_transform = transform1 + transform2

Full example

import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D

# Create two transformations
transform1 = Affine2D().rotate_deg(45)
transform2 = Affine2D().scale(2)

# Combine the two transformations
combined_transform = transform1 + transform2