|
From: Andre' Walker-L. <wal...@gm...> - 2012-12-17 19:04:03
|
> I am a matplotlib.pyplot novice, but I have looked through various FAQs to no avail. > > I am plotting a polar graph with some negative values of r. Everything goes well until I try to use rgrids(). Am I doing something wrong? > > I attach some demo scripts and their outputs. > > version1.py uses rgrid() but only has positive values of r. Everything works the way I expect it to (see version1.png). > > version2.py has negative values of r and the same call to rgrid() and misbehaves (see version2.png). > > version3.py is the same as version2.py, but without the call to rgrids() (but with negative values of r). Again everything is as expected. > > What am I doing wrong in version2.py? and only because it (sadly) took me a few minutes to figure out (even though it seemed so obvious), to create the plot of your version 3, with only positively defined values for "r", you can do t = numpy.linspace(0,2*numpy.pi,61) r = t t2 = numpy.linspace(-numpy.pi,numpy.pi,61) r2 = numpy.pi - t2 plt.polar(t,r) plt.polar(t2,r2) andre |