Implicit plot with plots

So for example if I want to plot the curve given by the implicit equation x^2+y^2 = 1, I can use the following python code.

   import numpy as np
   import matplotlib.pyplot as plt
   y,x=np.ogrid[-5:5:100j,-5:5:100j]
   plt.contour(x.ravel(),y.ravel(),x^2+y^2,[1])
   plt.show()

The result is a circle of radius 1 centered at the origin. Now using the contour function for an implicit plot is as far as I understand a hack.

I can see that sympy has now a proper plot_implicit function that is documented (and live demonstrated) together with its source code here.

Thanks for your help!

1 Like