I would like to display a grid with a plot using Sympy:
import sympy
from sympy import sin
from sympy.abc import x
from math import pi
sympy.plot(sin(x),xlim=(0,2*pi))
Using matplotlib it is straight forward to add a grid :
import matplotlib.pylab as plt
plt.grid(True)
plt.show()
How can I do this with Sympy?
Since SymPy uses matplotlib under the hood if you have it available, you can use:
from matplotlib import style
style.use('ggplot')
And that will style your sympy.plot()
To print all available styles, use:
import matplotlib as plt
print(plt.style.available)
Here's a link about style for matplotlib