thetamin/-max for polar plot #328

Open
ddale opened this Issue Jun 20, 2011 · 8 comments

Comments

Projects
None yet
9 participants
Contributor

ddale commented Jun 20, 2011

Original report at SourceForge, opened Sun Jun 15 16:58:00 2008

It would be nice if there is a possibility to display only a circular sector of a polar plot.
At the moment there is always plotted the full circle (360 degree).

So I suggest a thetamax and thetamin parameter for the polar plot.

Thanks!

On a similar note , I constantly face this problem and method to solve would be appreciated.
and would like to have an extrapolation routine for theta domain.

As mentioned in the previous comment that At the moment matplotlib only plots the full circle (360 degree).
So if one has a theta domain from 0.01 to 2.0_pi-0.01 then it leaves white space (i.e. it does not complete the whole circle)
One usually encounters such domains in numerical grid as starting the value of theta from 0.0 could lead to singularities.
Is there any way to get rid of this white space by forcing the theta domain to start from 0.0 to 2.0_pi and extrapolating the associated 2D data on the polar axis?

pelson was assigned Oct 18, 2012

Contributor

mspacek commented Dec 14, 2013

I wonder how much work this would be to implement. It seems the set_xlim() and set_ylim() axes methods for polar plots are supposed to control theta and r limits respectively. set_ylim works as expected for r, though unfortunately set_xlim() doesn't seem to have any effect at all, unless I'm doing something wrong.

There's also a set_rlim() which seems to do the same as set_ylim(), and there are get_rmax and get_rmin methods, but strangely no get_rlim method.

Seems example 2 and 3 in this demo show a way forward for doing less than a full 360 deg polar plot, and also for creating an annulus. Looks a bit complicated though:
http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#floating-axes

Some discussion from 2008:
http://comments.gmane.org/gmane.comp.python.matplotlib.general/14711

Contributor

mspacek commented Dec 17, 2013

I hacked together something that works well enough for me, based on the floating-axes demo from mpl_toolkits. Here's the code:

https://github.com/neuropy/neuropy/blob/master/neuropy/scripts/polar_demo.py

And a couple of example plots:

figure_1
figure_2

tacaswell added this to the v1.5.x milestone Aug 18, 2014

Owner

tacaswell commented Aug 18, 2014

@mspacek Would you be willing to put that into a PR?

Maybe this belongs in mpl_toolkit.

drrossum commented Sep 8, 2014

+1
I would be very interested in this feature too. Will use mspacek's routine for now

Member

QuLogic commented Jul 14, 2015

So what's the actual way going forward here? Copying stuff from mpl_toolkit into the polar axes? (That code is ugly.)

The best result (from a user perspective) would be being able to set theta min/max on a regular polar axes. Using mpl_toolkit is already in the examples and not particularly nice.

Contributor

mspacek commented Jul 14, 2015

I agree, I think it would be best to make this a feature of pylab.polar(). Even when I wrote it, I didn't understand some of the code in

https://github.com/neuropy/neuropy/blob/master/neuropy/scripts/polar_demo.py

which itself was mostly copied from mpl_toolkits:

http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#floating-axes

I just got it to work through trial and error. So, I'm not sure I'm qualified to merge this into pyplot.polar().

QuLogic referenced this issue Jul 15, 2015

Open

Polar limits enhancements #4699

3 of 3 tasks complete

story645 added the polar label May 31, 2016

QuLogic self-assigned this Nov 15, 2016

caichao commented Jan 11, 2017

wonderful works. @mspacek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment