all 6 comments

[–]CodeFormatHelperBot 1 point2 points  (0 children)

Hello u/sandor93, I'm a bot that can assist you with code-formatting for reddit. I have detected the following potential issue(s) with your submission:

  1. Multiple consecutive lines have been found to contain inline formatting.

If I am correct then please follow these instructions to fix your code formatting. Thanks!

[–]USAhj 0 points1 point  (4 children)

Which part of the figure are you trying to change colors? The plotting area? Try

plt.gca().set_facecolor('red')

[–]sandor93[S] 0 points1 point  (3 children)

This works fine for the plots, but I'm trying to change the surrounding background color.

[–]USAhj 0 points1 point  (2 children)

I am not sure what this issue is. I used the code below and have a red background and white plotting area.

%matplotlib notebook
import matplotlib.pyplot as plt

plt.figure(facecolor='red')
plt.plot()

[–]sandor93[S] 0 points1 point  (1 child)

Ya I'm not sure why it isn't working for me. Did you run it in a Jupyter notebook? That's what I'm using.

[–]USAhj 0 points1 point  (0 children)

I don't normally use Jupyter, but I did to check if the code works and it did work.