Closed
Description
Bug summary
I've been adding annotations following the excellent examples at AnnotationBbox demo, but I'd like to make the text box transparent. From the TextArea docs it looks like my_text_area.set(alpha=x)
should work, but it doesn't seem to have any effect.
Perhaps there is another way to set this that I have missed?
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.offsetbox import TextArea, AnnotationBbox
import numpy as np
rng = np.random.default_rng()
data = rng.normal(size=30)
plt.rcdefaults()
_ , ax = plt.subplots()
ax.hist(data)
offsetbox = TextArea('Look over there!')
offsetbox.set(alpha=0.3)
ab = AnnotationBbox(offsetbox, (0.8, 0.8),
xybox=(0, 1),
xycoords='axes fraction',
boxcoords='data',
arrowprops=dict(arrowstyle="->"))
ax.add_artist(ab)
plt.show()
Actual outcome
Expected outcome
The text box should be transparent.
Additional information
I tried a few versions back to 3.3, but the result was the same.
Operating system
RHEL7
Matplotlib Version
3.6.2
Matplotlib Backend
QtAgg
Python version
3.8.13
Jupyter version
N/A
Installation
conda