Hi Andre,

Le 18/12/2012 06:52, Andre' Walker-Loud a écrit :
> There is no mention in the docs about the treatment of negative "r".  The 
> treatment is contrary to my expectations, and I would wager contrary to many 
> peoples expectations.  So at a new minimum, at the very least, the docs 
> should make clear what is happening.
>
> I would further suggest that there are options specified by kwargs what the 
> behavior is.  The default could be the current behavior, which sounds like it 
> is standard to some, and another option would be to complain if r < 0, as I 
> think many others would expect.
I fully agree with the idea of enabling users to specify the behavior
they want. I'm not sure about raising an error, but it's true that it
can be pretty helpful to detect computational mistakes.

The way polar plots are implemented now seems to be a generalization of
usual polar coordinate mapping. Indeed, we have in [1] the following
mapping (let's call it T) :

T : (r, θ) ⟶ ((r-rmin) cos(θ), (r-rmin) sin(θ) )

which is parametrized by rmin.
Currently this 'rmin' is get from the ymin property of axis.viewLim
which can be set by ax.set_lim(ymin=...)

I see this "radius offsetting" functionality pretty useful in some cases
like drawing antenna diagrams in dB like [2]. For such a usecase, a
radius (ie r-rmin) going negative could raise an error.

In some other usecases like with a polar rose [3], the radius going
negative (and indeed it may not be called radius anymore...) is
perfectly legitimate and is the expected behavior. Also, the mapping T
currently implemented in [1] supports it perfectly.


In conclusion, I think matplotlib in its currently almost perfectly(*)
able to deal with both use cases thanks to this parametrized polar
mapping T. However, the current state of the documentation doesn't
reflects this flexibility. Also, an additional keyword argument could
help to specify the expected behavior, especially in term of error raising.

Best,
Pierre


[1]
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/projections/polar.py#L61
[2] https://hamstudy.org/browse/E4_2012/E9B
[3] http://en.wikipedia.org/wiki/Polar_coordinate_system#Polar_rose
(*) rgrids function raises an error for negative r values (see
polar.py#L537). This could be annoying for radiation patterns in dB

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to