I just got a new PC and downloaded visual studio code. I'm trying to run the exact same plots as the code I had on my other PC (just plt.plot(losses)
) but now matplotlib
seems to have a dark background instead of white:
I found this and this that had opposite problems. To clarify, I'm asking how to change the matplotlib background plots to white (note that in my other machine I didn't have to hard code any matplotlib background information so I think it's a visual studio problem, but couldn't figure it out)
CodePudding user response:
Difficult to be sure since I cannot reproduce your problem.
Two things to try (both presume that you import matplotlib using import matplotlib.pyplot as plt
):
- if you use
plt.figure
, addfacecolor='white'
parameter. Or try to runfig.set_facecolor('white')
(fig
here is the variable that stored the figure which facecolor you are changing. If you don't have any, useplt.gcf().set_facecolor('white')
once the figure is created;gcf()
returns current figure, see this doc). - Try to change
plt.style.context
as in this matplotlib example.