I need to plot this graph (exactly as in the picture). It is sin and cos of x, where x are equally spaced 100 numbers between 0 and 2 pi.
So far, I wrote
x=np.linspace(0, 2*math.pi,100)
import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figsize=(10,5))
plt.yticks(np.arange(-1,1.25,0.25))
plt.xticks(np.arange(0, 7, 1))
plt.plot(x,np.cos(x),'r',label="sine")
plt.plot(x,np.sin(x),'b',label="cosine")
plt.xlabel('x (in radians)')
plt.legend(loc=3)
But the plot I get looks like this
How do I make the legend smaller, the box for the legend in grey and the plot indented?
Editing: I am using the version of Matplotlib 2.1.0 [proof][https://i.stack.imgur.com/FFXFV.png]