Closed
Description
Is there a way to change a legend's background color using styles (or equivalently, matplotlib rcParams)?
Say I set the axes background colors to grey, and I want my legend to pop out a bit more. I can set the axes background in my style, but I can't seem to find a way to do it for the legend.
import matplotlib.pyplot as plt
plt.style.use('mystyle')
plt.plot(np.random.sample(10), label='test')
legend = plt.legend()
# how do I automate these two lines
frame = legend.get_frame()
frame.set_facecolor('1')
plt.show()
mystyle.mplstyle :
axes.facecolor: E5E5E5
axes.edgecolor: white
axes.grid: True
xtick.color: 555555
xtick.direction: out
ytick.color: 555555
ytick.direction: out
grid.color: white
grid.linestyle: - # solid line
figure.facecolor: white
figure.edgecolor: 0.50
Metadata
Metadata
Assignees
Labels
No labels