7

enter image description here

This pic is plot by R, and what I want to know is how do it with matplotlib. I have tried the plt.title('aaa', backgroundcolor= 'silver'), but it only change the background color where the text cover.

enter image description here

So any methods to do this? Thanks

Simon
  • 9,762
  • 15
  • 62
  • 119
Ming Jia
  • 71
  • 1
  • 3

1 Answers1

-3

You can try this:

import matplotlib.pyplot as plt
plt.rcParams['axes.facecolor'] = 'silver'
Tyson
  • 55
  • 15
  • This doesn't work as expected. The linked duplicate provides a better answer. https://stackoverflow.com/questions/40796117/how-do-i-make-the-width-of-the-title-box-span-the-entire-plot – Andrew Fogg Aug 05 '22 at 17:20