Skip to content

Polar plot autoscaling changes radial bound to negative. #15814

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

Closed
TD22057 opened this issue Dec 2, 2019 · 2 comments
Closed

Polar plot autoscaling changes radial bound to negative. #15814

TD22057 opened this issue Dec 2, 2019 · 2 comments

Comments

@TD22057
Copy link
Contributor

TD22057 commented Dec 2, 2019

Bug report

The input data in the script below should make a straight line on a polar plot. When autoscaling is off, the resulting line looks correct. When autoscaling is turned on (which is the default), the line has a strange bend around the center of the plot.

It appears that the autoscaling algorithm is adding a pad which makes the radial scale go negative. I could be wrong but I think that's not correct behavior and the radial axis should be bounded at 0.

import pylab
pylab.matplotlib.rcParams['interactive'] = True

x = [2.901676526904393, 2.9012943951345322, 2.9008264463184146, 2.900251974536176, 2.8995434240434714, 2.8986632998940496, 2.8975592417044105, 2.896155845305896, 2.8943404182054597, 2.8919366806494335, 2.888652559319873, 2.8839664605646798, 2.876846822907351, 2.8649279251651056, 2.8413281415735243, 2.7741754185913265, 1.844830893988377, 6.224724111905722, 6.138489000172224, 6.111321790945689, 6.0981736547178755, 6.090509944966482, 6.0855552660746755, 6.082137431088338, 6.079676052745924, 6.077850957762468, 6.076471064504868, 6.075415284460905, 6.074603165092719, 6.073979164563473, 6.073503704258087, 6.073147819211094, 6.07288982451639, 6.0727131641587055]

y = [1.07962386292976, 1.044422417525868, 1.0064402062381226, 0.9653486094255949, 0.920785277458781, 0.8723569703753221, 0.8196468528318069, 0.7622284862741852, 0.699689291693624, 0.6316664569433821, 0.5578976274920968, 0.47828656447751405, 0.39297980503016783, 0.30244538042662383, 0.207548088666055, 0.10971430600558985, 0.017669567101071815, 0.09310198323363816, 0.19114252617493488, 0.2865654508503026, 0.37779150232498293, 0.4638890112628551, 0.5443368387541254, 0.6189466207692367, 0.6877843659040478, 0.7510927872415143, 0.8092236681586527, 0.8625849374996973, 0.9116027372460488, 0.9566963415173629, 0.9982629771777992, 1.036669713663131, 1.0722500953432978, 1.1053037734102051]

fig = pylab.figure()
ax = fig.add_axes((0.05,0.1,0.90,0.80),projection='polar')
ax.grid(True)     

# Uncomment to see the correct plot
#ax.set_autoscale_on(False)

ax.plot(x, y)
pylab.show()       

Here is the incorrect result when autoscaling is on:

wrong_autoscale_on

Here is the correction result when autoscaling is off:
right_autoscale_on

Matplotlib version

  • Operating system: RedHat Linux 7.4
  • Matplotlib version: 3.1.1
  • Matplotlib backend: Qt5Agg
  • Python version: 3.7.4
@timhoffm
Copy link
Member

timhoffm commented Dec 2, 2019

Should be addressed by #13980.

@TD22057
Copy link
Contributor Author

TD22057 commented Dec 3, 2019

Thanks - I should have caught that. Case works correctly w/ the latest repo code.

@TD22057 TD22057 closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants