I'm newbie with matplotlib. I try to save a statistical graph which I generate with some data. I try to save it before to show the image of the graph.
The image that I can see is this:
And the image that I save in my hard disk is this:
The code where I define the background is this:
if background_color is not None:
self.background_color = background_color
else:
self.background_color = STATISTICS_GRAPH.BACKGROUND_COLOR
if size is not None:
self.size = size
else:
self.size = (STATISTICS_GRAPH.WIDTH, STATISTICS_GRAPH.HEIGHT)
#We create the container of our statistical graphic
self.fig, self.axes = plt.subplots(facecolor = self.background_color,
figsize=self.size)
And here the code where I save and show the image:
plt.savefig("files/images/processed/" + self.get_league_name() + "_" + self.get_competition_name() + ".png", dpi = 300)
plt.show()
So, what am I doing wrong to show the image with its background correctly and save it without the background color?