-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Description
Bug summary
If I rotate an image, the background of its bounding box is rendered black when rendering as .pdf or .png
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D
import numpy as np
img = np.random.random((100, 20, 3))
tr_rotate = Affine2D().rotate_deg_around(0 / 2, 0 / 2, 45)
tr_translate = Affine2D().translate(250, 250)
fig, ax = plt.subplots()
ax.imshow(
img,
transform=tr_rotate + ax.transData,
clip_on=False,
)
ax.imshow(
img,
transform=tr_translate + ax.transData,
clip_on=False,
)
ax.set_xlim(-250, 500)
ax.set_ylim(-250, 500)
fig.savefig("MWE.png")
Actual outcome
Expected outcome
Transparent Bounding Box
Additional information
In the past this was possible, however I don't know which version of matplotlib was used...
Operating system
KDE Neon
Matplotlib Version
3.9.2
Matplotlib Backend
tkagg
Python version
3.12.3
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels