I am trying to plot using matplotlib with python 3.7.
This is my code:
import matplotlib
fig = matplotlib.pyplot.figure()
rect = fig.patch
rect.set_facecolor("green")
x = [3, 7, 8, 12]
y = [5, 13, 2, 8]
graph1 = fig.add_subplot(1, 1, axisbg="black")
graph1.plot(x, y, "red", linewidth=4.0)
matplotlib.pyplot.show()
But I keep getting this error:
File "C:\Users\User\Anaconda3\lib\site-packages\matplotlib\axes\_subplots.py", line 72, in __init__
raise ValueError('Illegal argument(s) to subplot: %s' % (args,))
ValueError: Illegal argument(s) to subplot: (1, 1)
What is the problem?