Closed
Description
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:
Here is the correction result when autoscaling is off:
Matplotlib version
- Operating system: RedHat Linux 7.4
- Matplotlib version: 3.1.1
- Matplotlib backend: Qt5Agg
- Python version: 3.7.4