# uniqueness of polar coordinates (meaningfulness of r<0)

http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates

quoting from the site

'''
Where a unique representation is needed for any point, it is usual to limit r to non-negative numbers (r ≥ 0) and θ to the interval [0, 360°) or (−180°, 180°] (in radians, [0, 2π) or (−π, π]). One must also choose a unique azimuth for the pole, e.g., θ = 0.
'''

Of course I don't have anything close to a scientific study of the following statement, but I suspect in practice (ie as polar coordinates are used in practice by working scientists), they expect to find values of "r" consistent with the above definition of unique - however, still wanting theta to not be bounded.

Taking another quote form the site

'''
Also, a negative radial coordinate is best interpreted as the corresponding positive distance measured in the opposite direction.
'''

How does one define opposite in polar coordinates? The natural definition for "opposite" direction is presumably theta --> theta + pi, as that definition would correspond to the same notion of "opposite" in Cartesian coordinates (take whatever direction you were drawing a line, and go in "-" that direction. If we agree that this is the sensible definition of opposite, then pyplot.polar is not representing this definition of opposite.

Attached are two plots. The first uses

''' as matplotlib is - neg_r.png '''
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(-np.pi, np.pi, 60)
r = t
plt.polar(t,r)

The second produces a curve which I say represents the natural definition of "opposite". Note, the tangents of the curves are also opposite as well

''' as matplotlib "should be" - neg_r_opposite.png '''
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0, np.pi, 30)
r = t
plt.polar(t,r)
t_opp = np.linspace(np.pi,2*np.pi,30)
r_opp = t_opp - np.pi
plt.polar(t_opp,r_opp)

I have three points to make with these plots:
1) my definition of opposite makes more sense than the default behavior of matplotlib
2) other people may have different ideas about what is best
3) matplotlib should at least raise a NOISY warning about what it is doing.

Andre  Maybe I’m just not seeing it; I don’t see how the definition on wikipedia, your definition, and matplotlib behavior differ.

import numpy as np
import matplotlib

matplotlib.use(‘WxAgg’)

import matplotlib.pyplot as plt

t = np.linspace(0.0,2.0*np.pi, 50)

r = np.linspace(0.0,2.0*np.pi, 50)

plt.polar(t,r,color=‘blue’)

plt.polar(t,-r,color=‘red’)

plt.polar(-t,r,color=‘green’)

plt.polar(-t,-r,color=‘yellow’)

plt.show()

Comparing blue and red, you can see how mpl handles a negative r; each point is ‘opposite’ just as described.

Comparing blue and green, you can see how mpl handles a negative angle. green curve increases in as you go clockwise, which is correct.

···

On Mon, Dec 17, 2012 at 6:54 PM, Andre’ Walker-Loud <walksloud@…1003…7…> wrote:

http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates

quoting from the site

‘’’

Where a unique representation is needed for any point, it is usual to limit r to non-negative numbers (r ≥ 0) and θ to the interval [0, 360°) or (−180°, 180°] (in radians, [0, 2π) or (−π, π]). One must also choose a unique azimuth for the pole, e.g., θ = 0.

‘’’

Of course I don’t have anything close to a scientific study of the following statement, but I suspect in practice (ie as polar coordinates are used in practice by working scientists), they expect to find values of “r” consistent with the above definition of unique - however, still wanting theta to not be bounded.

Taking another quote form the site

‘’’

Also, a negative radial coordinate is best interpreted as the corresponding positive distance measured in the opposite direction.

‘’’

How does one define opposite in polar coordinates? The natural definition for “opposite” direction is presumably theta --> theta + pi, as that definition would correspond to the same notion of “opposite” in Cartesian coordinates (take whatever direction you were drawing a line, and go in “-” that direction. If we agree that this is the sensible definition of opposite, then pyplot.polar is not representing this definition of opposite.

Attached are two plots. The first uses

‘’’ as matplotlib is - neg_r.png ‘’’

import numpy as np

import matplotlib.pyplot as plt

t = np.linspace(-np.pi, np.pi, 60)

r = t

plt.polar(t,r)

The second produces a curve which I say represents the natural definition of “opposite”. Note, the tangents of the curves are also opposite as well

‘’’ as matplotlib “should be” - neg_r_opposite.png ‘’’

import numpy as np

import matplotlib.pyplot as plt

t = np.linspace(0, np.pi, 30)

r = t

plt.polar(t,r)

t_opp = np.linspace(np.pi,2*np.pi,30)

r_opp = t_opp - np.pi

plt.polar(t_opp,r_opp)

I have three points to make with these plots:

1. my definition of opposite makes more sense than the default behavior of matplotlib

2. other people may have different ideas about what is best

3. matplotlib should at least raise a NOISY warning about what it is doing.

Andre

LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial

Remotely access PCs and mobile devices and provide instant support

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

Daniel Hyams
dhyams@…1972…

Is this in reference to issue #1603? Are you advocating changing the solution?

Cheers,
Mike

···

On 12/17/2012 05:50 PM, Alan G Isaac wrote:

http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates

fwiw,
Alan Isaac

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
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

My only point was that the ongoing conversation should
not accept uncritically the assertion that r<0 is senseless.
Thus I cited one example of the common acceptance of negative r:
http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates

I am not advocating a position on whether Matplotlib should enforce a unique
representation, although that seems very doubtful to me.

Alan

···

On 12/18/2012 9:40 AM, Michael Droettboom wrote:
> Is this in reference to issue #1603? Are you advocating changing the
> solution?

Sorry -- I hadn't meant to be terse: I hadn't realised until now that this was related to the other thread. I think it's an interesting discussion, and we should probably find some way to address it -- perhaps that means that `polar` grows an option to affect negative handling.

Mike

···

On 12/18/2012 10:08 AM, Alan G Isaac wrote:

On 12/18/2012 9:40 AM, Michael Droettboom wrote:
> Is this in reference to issue #1603? Are you advocating changing the
> solution?

My only point was that the ongoing conversation should
not accept uncritically the assertion that r<0 is senseless.
Thus I cited one example of the common acceptance of negative r:
http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates

I am not advocating a position on whether Matplotlib should enforce a unique
representation, although that seems very doubtful to me.

Alan

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
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

Is this in reference to issue #1603? Are you advocating changing the
solution?

My only point was that the ongoing conversation should
not accept uncritically the assertion that r<0 is senseless.

and I finally appreciate that criticism.

I think it is clear to all on the list, that at first, this notion railed against my senses.

Cheers,

Andre

···

From my perspective, I was happy to learn something new.