New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
negative polar values #2133
Comments
Just as a simple example of the change: import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='polar')
theta = [0, np.pi/2]
ax.plot(theta, [0.5, 0.5], 'ro')
ax.plot(theta, [-0.5, -0.5], 'go')
plt.show() With v1.2.0 and earlier, the above example results in: With 1.2.1 (and the current git head): As a simple test for the behavior: from matplotlib.projections import PolarAxes
import numpy as np
trans = PolarAxes.PolarTransform()
result = trans.transform_point([0, -1])
assert not all(np.isnan(result)) As @tacaswell mentioned, this is a result of #1603. That bugfix would seem to indicate that "reflecting" negative radius values to the opposite direction was never supposed to be the intended behavior. However, it's how polar plots have worked in matplotlib for quite some time. Which one is the "correct" behavior? |
I've been thinking about this for a few days now, and I have come to the conclusion that v1.2.1 fixed a long-standing bug with how negative radii were handled. Any time I've used polar coordinates the radius was always positive and if you wanted points in the opposite direction you must change the
For that reason, I think I'm going to close this. If anybody would like to reopen to continue discussion, please feel free to do so. |
https://en.wikipedia.org/wiki/Polar_coordinate_system Under "Uniqueness of polar coordinates": "Similarly, any polar coordinate is identical to the coordinate with the negative radial component and the opposite direction (adding 180° to the polar angle)." This suggests that the original behavior was correct. |
That is true if you really want to plot polar coordinates (which also implies you always have to start from 0 radius in the center). Even though the projection is called 'polar', this radial plot has a broader scope in which negative values may actually exist at certain angles and are not equivalent to the absolute value rotated by 180 degrees. |
A issue raised in this (http://stackoverflow.com/questions/17154006/pyplot-polar-scatter-plot-color-for-sign) SO question, the way that polar plots handles negative numbers changed between 1.2.0 and 1.2.1.
If this is an un-intentional change, should probably be fixed before 1.3.0.
maybe related to #1603
The text was updated successfully, but these errors were encountered: